(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode("")),document.head.appendChild(e)}}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
import { EVENT as C, TUICallEngine as Ze } from "tuicall-engine-wx";
import { TUICore as $, TUIConstants as S, TUILogin as $e } from "@tencentcloud/tui-core";
import Re from "@tencentcloud/chat";
var n = /* @__PURE__ */ ((r) => (r.CALL = "call", r.CUSTOM = "custom", r))(n || {}), L = /* @__PURE__ */ ((r) => (r[r.UNKNOWN = 0] = "UNKNOWN", r[r.AUDIO = 1] = "AUDIO", r[r.VIDEO = 2] = "VIDEO", r))(L || {}), m = /* @__PURE__ */ ((r) => (r.UNKNOWN = "unknown", r.CALLEE = "callee", r.CALLER = "caller", r))(m || {}), d = /* @__PURE__ */ ((r) => (r.IDLE = "idle", r.CALLING = "calling", r.CONNECTED = "connected", r))(d || {}), re = /* @__PURE__ */ ((r) => (r.CONTAIN = "contain", r.COVER = "cover", r.FILL = "fill", r))(re || {}), oe = /* @__PURE__ */ ((r) => (r.RESOLUTION_480P = "480p", r.RESOLUTION_720P = "720p", r.RESOLUTION_1080P = "1080p", r))(oe || {}), Pe = /* @__PURE__ */ ((r) => (r.EN = "en", r["ZH-CN"] = "zh-cn", r.JA_JP = "ja_JP", r))(Pe || {});
const R = {
  IDLE: "idle",
  BE_INVITED: "be-invited",
  DIALING_C2C: "dialing-c2c",
  DIALING_GROUP: "dialing-group",
  CALLING_C2C_AUDIO: "calling-c2c-audio",
  CALLING_C2C_VIDEO: "calling-c2c-video",
  CALLING_GROUP_AUDIO: "calling-group-audio",
  CALLING_GROUP_VIDEO: "calling-group-video"
}, et = {
  unknown: 0,
  audio: 1,
  video: 2
  /* VIDEO */
};
var T = /* @__PURE__ */ ((r) => (r.EAR = "ear", r.SPEAKER = "speaker", r))(T || {}), ne = /* @__PURE__ */ ((r) => (r[r.FRONT = 0] = "FRONT", r[r.BACK = 1] = "BACK", r))(ne || {}), Y = /* @__PURE__ */ ((r) => (r.Camera = "camera", r.Microphone = "microphone", r.SwitchCamera = "switchCamera", r.InviteUser = "inviteUser", r))(Y || {}), J = /* @__PURE__ */ ((r) => (r.Open = "open", r.Close = "close", r))(J || {}), Ke = /* @__PURE__ */ ((r) => (r.LocalInLargeView = "local", r.RemoteInLargeView = "remote", r))(Ke || {});
const Ne = {
  SWITCH_TO_AUDIO_CALL_FAILED: 60001,
  SWITCH_TO_VIDEO_CALL_FAILED: 60002,
  MICROPHONE_UNAVAILABLE: 60003,
  CAMERA_UNAVAILABLE: 60004,
  BAN_DEVICE: 60005,
  NOT_SUPPORTED_WEBRTC: 60006,
  ERROR_BLACKLIST: 20007
}, tt = {
  SWITCH_TO_AUDIO_CALL_FAILED: "switchToAudioCall-call-failed",
  SWITCH_TO_VIDEO_CALL_FAILED: "switchToVideoCall-call-failed",
  MICROPHONE_UNAVAILABLE: "microphone-unavailable",
  CAMERA_UNAVAILABLE: "camera-unavailable",
  BAN_DEVICE: "ban-device",
  NOT_SUPPORTED_WEBRTC: "not-supported-webrtc",
  ERROR_BLACKLIST: "blacklist-user-tips"
};
var Ve = /* @__PURE__ */ ((r) => (r[r.NORMAL = 0] = "NORMAL", r[r.RELEASE = 1] = "RELEASE", r[r.WARNING = 2] = "WARNING", r[r.ERROR = 3] = "ERROR", r[r.NONE = 4] = "NONE", r))(Ve || {});
const Ae = {
  CALL_STATUS: "callStatus",
  CALL_ROLE: "callRole",
  CALL_MEDIA_TYPE: "callMediaType",
  LOCAL_USER_INFO: "localUserInfo",
  LOCAL_USER_INFO_EXCLUDE_VOLUMN: "localUserInfoExcludeVolume",
  REMOTE_USER_INFO_LIST: "remoteUserInfoList",
  REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST: "remoteUserInfoExcludeVolumeList",
  CALLER_USER_INFO: "callerUserInfo",
  IS_GROUP: "isGroup",
  CALL_DURATION: "callDuration",
  CALL_TIPS: "callTips",
  TOAST_INFO: "toastInfo",
  IS_MINIMIZED: "isMinimized",
  ENABLE_FLOAT_WINDOW: "enableFloatWindow",
  BIG_SCREEN_USER_ID: "bigScreenUserId",
  LANGUAGE: "language",
  IS_CLICKABLE: "isClickable",
  DISPLAY_MODE: "displayMode",
  VIDEO_RESOLUTION: "videoResolution",
  PUSHER: "pusher",
  PLAYER: "player",
  IS_EAR_PHONE: "isEarPhone",
  IS_MUTE_SPEAKER: "isMuteSpeaker",
  SHOW_PERMISSION_TIP: "SHOW_PERMISSION_TIP",
  NETWORK_STATUS: "NetWorkStatus",
  GROUP_ID: "groupID",
  ROOM_ID: "roomID",
  ROOM_ID_TYPE: "roomIdType",
  SHOW_SELECT_USER: "showSelectUser",
  IS_SHOW_ENABLE_VIRTUAL_BACKGROUND: "isShowEnableVirtualBackground",
  ENABLE_VIRTUAL_BACKGROUND: "enableVirtualBackground",
  GROUP_CALL_MEMBERS: "groupCallMembers",
  PUSHER_ID: "pusherId"
}, at = {
  INNER_ATTR_KIT_INFO: "inner_attr_kit_info"
}, it = {
  INITIAL_PUSHER: "initialPusher",
  NEW_PUSHER: "newPusher"
}, a = {
  PREFIX: "【CallService】",
  AUDIO: "audio",
  VIDEO: "video",
  LOCAL_VIDEO: "localVideo",
  ERROR: "error",
  TIMEOUT: "timeout",
  RAF: "raf",
  INTERVAL: "interval",
  DEFAULT: "default",
  BOOLEAN: "boolean",
  STRING: "string",
  NUMBER: "number",
  OBJECT: "object",
  ARRAY: "array",
  FUNCTION: "function",
  UNDEFINED: "undefined",
  UNKNOWN: "unknown",
  ALL: "all",
  MYSELF: "myself",
  DEVICE_LIST: "deviceList",
  CAMERA_POSITION: "cameraPosition",
  CUSTOM_UI_CONFIG: "customUIConfig",
  ...it,
  ...Ae,
  ...at
}, rt = "https://web.sdk.qcloud.com/component/TUIKit/assets/call.png", ot = "https://web.sdk.qcloud.com/component/TUIKit/assets/call-video-reverse.svg", Te = 2147483647, me = 4;
var Se = /* @__PURE__ */ ((r) => (r[r.TUI_CALL_KIT = 14] = "TUI_CALL_KIT", r[r.TIM_CALL_KIT = 15] = "TIM_CALL_KIT", r))(Se || {}), De = /* @__PURE__ */ ((r) => (r[r.NUMBER_ROOM_ID = 1] = "NUMBER_ROOM_ID", r[r.STRING_ROOM_ID = 2] = "STRING_ROOM_ID", r))(De || {});
function nt() {
  wx.hideKeyboard && wx.hideKeyboard({
    complete: () => {
    }
  });
}
function lt() {
  wx.getSystemInfoSync().platform === "devtools" && wx.showModal({
    icon: "none",
    title: "运行环境提醒",
    content: "微信开发者工具不支持原生推拉流组件(即 <live-pusher> 和 <live-player> 标签)，请使用真机调试或者扫码预览。",
    showCancel: !1
  });
}
function be() {
  nt(), lt();
}
async function st(r, e) {
  try {
    be();
    const t = {
      microphone: !0,
      camera: r === L.VIDEO
    };
    return await e._tuiCallEngine.deviceCheck(t) ? d.CALLING : d.IDLE;
  } catch (t) {
    return console.debug(t), d.IDLE;
  }
}
function At(r) {
  (r == null ? void 0 : r.code) === -1002 && wx.showModal({
    icon: "none",
    title: "error",
    content: (r == null ? void 0 : r.message) || "",
    showCancel: !1
  });
}
function ct() {
  wx.showModal({
    icon: "none",
    title: "权限提示",
    content: "当前小程序 appid 不具备 <live-pusher> 和 <live-player> 的使用权限，您将无法正常使用实时通话能力，请使用企业小程序账号申请权限后再进行开发体验",
    showCancel: !1
  });
}
const ut = {
  // 按钮文案
  hangup: "Hang up",
  reject: "Decline",
  accept: "Accept",
  camera: "Camera",
  microphone: "Microphone",
  speaker: "speaker",
  "open camera": "Open Camera",
  "close camera": "Close Camera",
  "open microphone": "Open Microphone",
  "close microphone": "Close Microphone",
  "video-to-audio": "Switch to audio",
  "virtual-background": "Blur Background",
  // 通话结果
  "other side reject call": "other side reject call",
  "reject call": "Reject Call",
  cancel: "Cancel Call",
  "other side line busy": "other side line busy",
  "in busy": "in busy",
  "call timeout": "call timeout",
  "no response from the other side": "no response from the other side",
  "end call": "end call",
  // 通话提示语
  "caller calling message": "Awaiting response",
  "callee calling video message": "invites you to a video call",
  "callee calling audio message": "invites you to a voice call",
  "no microphone access": "no microphone access",
  "no camera access": "no camera access",
  "invite member": "Invite Member",
  "Invited group call": "invites you to a group call",
  waiting: "Calling...",
  me: "(me)",
  // 弹出层文案
  "browser-authorization": "Browser authorization",
  "mac-privacy": "System Preferences -> Security and Privacy -> Privacy",
  "win-privacy": "Setting -> Privacy and Security -> App permissions",
  "mac-preferences": "Open System Preferences",
  "win-preferences": "Open Setting",
  "Please enter userID": "Please enter userID",
  "View more": "View more",
  "people selected": "people selected",
  "Select all": "Select all",
  Cancel: "Cancel",
  Done: "Done",
  "exist group call": "A group call already exists in the current group",
  // UI3.0 新增
  "camera enabled": "Camera On",
  "camera disabled": "Camera Off",
  "microphone enabled": "Unmuted",
  "microphone disabled": "Muted",
  "speaker phone": "Speaker",
  "ear piece": "Earpiece",
  "open speaker": "Turn on speaker",
  "close speaker": "Turn off speaker",
  "wait to be called": "Waiting",
  answered: "Connected",
  "people in the call": " other(s) in the call",
  "failed to obtain speakers": "failed to obtain speakers",
  "you have a new call": "You have a new call",
  "switch camera": "Switch",
  join: "Join",
  "people on the call": "people on the call",
  "Supports a maximum of 9 people for simultaneous calls": "Supports a maximum of 9 people for simultaneous calls",
  you: "(you)",
  "The network is poor during your current call": "The network is poor during your current call",
  "The other user network is poor during the current call": "The other party's network is poor during the current call",
  "TUICallKit init is not complete": "TUICallKit init is not complete. You need to use this API after the init API is finished.",
  // 待废弃文案
  "Those involved": "Those involved in the call are",
  call: "call",
  "video-call": "video call",
  "audio-call": "audio call",
  search: "search",
  "search-result": "search result",
  "no-user": "user not found",
  "member-not-added": "member not added",
  "input-phone-userID": "phone number or userID",
  "not-login": "not logged in",
  "login-status-expire": "login status is invalid, please refresh the page and try again",
  "experience-multi-call": "experience multi-person calls, please download the full-featured demo: ",
  "not-support-multi-call": "multi-person call interface is not open",
  userID: "userID",
  "already-enter": "entered the call",
  "camera-opened": "Camera on",
  "camera-closed": "Camera off",
  "microphone-opened": "Mic on",
  "microphone-closed": "Mic off",
  timeout: "timeout",
  "kick out": "kick out",
  "image-resolution": "Resolution",
  "default-image-resolution": "Default",
  "invited-person": "Invite",
  "be-rejected": "Call declined, ",
  "be-no-response": "No response, ",
  "be-line-busy": "Line busy, ",
  "be-canceled": "The call is canceled, ",
  "voice-call-end": "Voice call ended",
  "video-call-end": "Video call ended",
  "method-call-failed": "Failed to sync the operation",
  "failed-to-obtain-permission": "Failed to obtain permissions",
  "environment-detection-failed": "Failed to check the environment",
  "switchToAudioCall-call-failed": "switch to audio call method failed",
  "switchToVideoCall-call-failed": "switch to video call method failed",
  "microphone-unavailable": "No mic found",
  "camera-unavailable": "No camera found",
  "ban-device": "Device access denied",
  "not-supported-webrtc": "Your current environment does not support WebRTC",
  "blacklist-user-tips": "The identifier is in blacklist. Failed to send this message!",
  "is-already-calling": "TUICallKit is already on a call",
  "need-init": "Before initiating a call with TUICallKit, ensure that the TUICallKitServer.init() method has executed successfully. ",
  "can't call yourself": "Can't call yourself",
  // eslint-disable-line
  "Use-phone-and-computer": "Use your mobile phone and computer to experience video calls",
  "Wechat scan right QR code": "Wechat scan right QR code",
  "Scan the QR code above": "Scan the QR code above",
  "accept-error": "Accept failed",
  "accept-device-error": "Accept failed, unable to auth calling device",
  "call-error": "Start call failed"
}, It = {
  // 按钮文案
  hangup: "挂断",
  reject: "拒绝",
  accept: "接受",
  camera: "摄像头",
  microphone: "麦克风",
  speaker: "扬声器",
  "open camera": "打开摄像头",
  "close camera": "关闭摄像头",
  "open microphone": "打开麦克风",
  "close microphone": "关闭麦克风",
  "video-to-audio": "转语音通话",
  "virtual-background": "模糊背景",
  // 通话结果
  "other side reject call": "对方已拒绝",
  "reject call": "拒绝通话",
  cancel: "取消通话",
  "other side line busy": "对方忙线",
  "in busy": "正在忙",
  "call timeout": "呼叫超时",
  "end call": "结束通话",
  // 通话提示语
  "caller calling message": "等待对方接受邀请",
  "callee calling video message": "邀请你视频通话",
  "callee calling audio message": "邀请你语音通话",
  "no microphone access": "没有麦克风权限",
  "no camera access": "没有摄像头权限",
  "invite member": "邀请成员",
  "Invited group call": "邀请你加入多人通话",
  "Those involved": "参与通话的有：",
  waiting: "等待接听...",
  me: "(我)",
  // 弹出层文案
  "browser-authorization": "浏览器授权",
  "mac-privacy": "系统偏好设置 -> 安全与隐私 -> 隐私",
  "win-privacy": "设置 -> 隐私和安全性 -> 应用权限",
  "mac-preferences": "打开系统偏好设置",
  "win-preferences": "打开系统设置",
  "Please enter userID": "请输入 userID",
  "View more": "查看更多",
  "people selected": "人已选中",
  "Select all": "全选",
  Cancel: "取消",
  Done: "完成",
  "exist group call": "当前群组中已经存在群组通话",
  // UI3.0 新增
  "camera enabled": "摄像头已开",
  "camera disabled": "摄像头已关",
  "microphone enabled": "麦克风已开",
  "microphone disabled": "麦克风已关",
  "speaker phone": "扬声器已开",
  "ear piece": "扬声器已关",
  "open speaker": "开启扬声器",
  "close speaker": "关闭扬声器",
  "wait to be called": "等待接听",
  answered: "已接通",
  "people in the call": "人参与通话",
  "failed to obtain speakers": "无法获取扬声器",
  "you have a new call": "您有一个新的通话",
  "switch camera": "翻转",
  join: "加入",
  "people on the call": "人正在通话",
  "Supports a maximum of 9 people for simultaneous calls": "最多支持9人同时通话",
  you: "(你)",
  "The network is poor during your current call": "当前通话你的网络不佳",
  "The other user network is poor during the current call": "当前通话对方网络不佳",
  "TUICallKit init is not complete": "TUICallKit 初始化登录未完成，需要在 init 完成后使用此 API",
  // 待废弃文案
  timeout: "超时",
  "kick out": "被踢",
  call: "通话",
  "video-call": "视频通话",
  "audio-call": "音频通话",
  search: "搜索",
  "search-result": "搜索结果",
  "Wechat scan right QR code": "微信扫右二维码",
  "Use-phone-and-computer": "用手机与电脑互打体验视频通话",
  "Scan the QR code above": "扫描上方二维码",
  "no-user": "未搜索到用户",
  "member-not-added": "未添加成员",
  "not-login": "未登录",
  "login-status-expire": "登录状态已失效，请刷新网页重试",
  "experience-multi-call": "体验多人通话请下载全功能demo:",
  "not-support-multi-call": "多人通话接口未开放",
  "input-phone-userID": "请输入手机号/用户ID",
  userID: "用户ID",
  "already-enter": "已经进入当前通话",
  "image-resolution": "分辨率",
  "default-image-resolution": "默认分辨率",
  "invited-person": "添加成员",
  "be-rejected": "对方已拒绝，",
  "be-no-response": "对方无应答，",
  "be-line-busy": "对方忙线中，",
  "be-canceled": "对方已取消",
  "voice-call-end": "语音通话结束",
  "video-call-end": "视频通话结束",
  "method-call-failed": "同步操作失败",
  "failed-to-obtain-permission": "权限获取失败",
  "environment-detection-failed": "环境检测失败",
  "switchToAudioCall-call-failed": "切语音调用失败",
  "switchToVideoCall-call-failed": "切视频调用失败",
  "microphone-unavailable": "没有可用的麦克风设备",
  "camera-unavailable": "没有可用的摄像头设备",
  "ban-device": "用户禁止使用设备",
  "not-supported-webrtc": "当前环境不支持 WebRTC",
  "blacklist-user-tips": "发起通话失败，被对方拉入黑名单，禁止发起！",
  "is-already-calling": "TUICallKit 已在通话状态",
  "need-init": "TUICallKit 发起通话前需保证 TUICallKitServer.init() 方法执行成功",
  "can't call yourself": "不能呼叫自己",
  // eslint-disable-line
  "accept-error": "接通失败",
  "accept-device-error": "接通失败，通话设备获取失败",
  "call-error": "发起通话失败"
}, Ct = {
  // 按钮文案 
  hangup: "通話終了",
  reject: "拒否",
  accept: "応答",
  camera: "カメラ",
  microphone: "マイク",
  speaker: "スピーカー",
  "virtual-background": "ボケ背景",
  // 通话结果
  "other side reject call": "通話が拒否されました",
  "reject call": "通話拒否",
  cancel: "通話をキャンセル",
  "other side line busy": "相手が通話中です",
  "in busy": "通話中",
  "call timeout": "呼び出しタイムアウト",
  "end call": "通話終了",
  // 通话提示语
  "caller calling message": "応答を待っています",
  "callee calling video message": "ビデオ通話に招待されました",
  "callee calling audio message": "音声通話に招待されました",
  "no microphone access": "マイクにアクセスできません",
  "no camera access": "カメラにアクセスできません",
  "invite member": "メンバーを招待する",
  // 弹出层文案
  "browser-authorization": "ブラウザ認証",
  "mac-privacy": "システム環境設定 -> セキュリティとプライバシー ->プライバシー",
  "win-privacy": "設定 -> セキュリティとプライバシー ->アプリのアクセス許可",
  "mac-preferences": "システム環境設定を開く",
  "win-preferences": "システム設定を開く",
  "Please enter userID": "ユーザーIDを入力してください",
  "View more": "もっと見る",
  "people selected": "人が選択されました",
  "Select all": "すべて選択",
  Cancel: "キャンセル",
  Done: "完了",
  "exist group call": "現在のグループには既にグループ通話が存在しています",
  // UI3.0文案
  "open camera": "オープンカメラ",
  "close camera": "カメラを閉じる",
  "open microphone": "オープンマイク",
  "close microphone": "マイクを閉じる",
  "camera enabled": "カメラオン",
  "camera disabled": "カメラオフ",
  "microphone enabled": "マイクオン",
  "microphone disabled": "マイクオフ",
  "speaker phone": "スピーカーオン",
  "open speaker": "スピーカーをオンにする",
  "close speaker": "スピーカーの電源を切ります",
  "wait to be called": "待機中",
  answered: "接続済み",
  "people in the call": "通話に参加している人たち",
  "failed to obtain speakers": "スピーカーが見つかりません",
  "you have a new call": "新しい通話があります",
  "switch camera": "切り替え",
  join: "参加する",
  "people on the call": "人が通話中です",
  "Supports a maximum of 9 people for simultaneous calls": "最大で9人まで同時通話が可能です",
  you: "(あなた)",
  "The network is poor during your current call": "現在の通話で、あなたのネットワークは不良です",
  "The other user network is poor during the current call": "現在の通話で、相手側のネットワークが不良です",
  "TUICallKit init is not complete": "TUICallKitの初期化ログインが完了していません。init が完了した後にこのAPIを使用する必要があります。",
  // 待废弃文案
  timeout: "タイムアウト",
  "kick out": "キックアウトされました",
  "Invited group call": "グループ通話に招待されました。",
  "Those involved": "参加者：",
  call: "通話",
  "video-call": "ビデオ通話",
  "audio-call": "音声通話",
  search: "検索",
  "search-result": "検索結果",
  "Wechat scan right QR code": "WeChatで右側にあるQRコードを読み取ります。",
  "Use-phone-and-computer": "携帯電話とコンピュータを使用してビデオ通話を体験してください",
  "Scan the QR code above": "上のQRコードを読み取ります。",
  "no-user": "ユーザーが見つかりませんでした",
  "member-not-added": "メンバーが追加されていません",
  "not-login": "ログインしていません",
  "login-status-expire": "ログインの有効期限が過ぎています。ページを更新してもう一度お試しください",
  "experience-multi-call": "複数人で同時に音声通話できるグループ通話機能を体験するには、全機能のデモをダウンロードしてください",
  "not-support-multi-call": "グループ通話インターフェイスが開いていません",
  "input-phone-userID": "携帯電話番号/ユーザーIDを入力してください",
  userID: "ユーザーID",
  "already-enter": "すでに通話に参加しています",
  waiting: "応答を待っています...",
  "camera-opened": "カメラがオンになっています",
  "camera-closed": "カメラがオフになっています",
  "microphone-opened": "マイクがオンになっています",
  "microphone-closed": "マイクがオフになっています",
  "image-resolution": "解像度",
  "default-image-resolution": "デフォルト解像度",
  "invited-person": "メンバーを招待",
  "video-to-audio": "音声通話に切り替えます",
  me: "(自分)",
  "be-rejected": "通話が拒否されました, ",
  "be-no-response": "応答なし, ",
  "be-line-busy": "相手が通話中です, ",
  "be-canceled": "相手が通話をキャンセルしました",
  "voice-call-end": "音声通話が終了しました",
  "video-call-end": "ビデオ通話が終了しました",
  "method-call-failed": "操作の同期に失敗しました",
  "failed-to-obtain-permission": "権限の取得に失敗しました",
  "environment-detection-failed": "環境の検出に失敗しました",
  "switchToAudioCall-call-failed": "音声通話に切り替えることはできません",
  "switchToVideoCall-call-failed": "ビデオ通話に切り替えることはできません",
  "microphone-unavailable": "使用できるマイクがありません",
  "camera-unavailable": "使用できるカメラがありません",
  "ban-device": "デバイスへのアクセスが拒否されました",
  "not-supported-webrtc": "現在の環境はWebRTCをサポートしていません",
  "blacklist-user-tips": "ユーザーはブラックリストに登録され、通話が開始できませんでした",
  "is-already-calling": "TUICallKit はすでに通話中です",
  "need-init": "TUICallKitで通話を開始する前に、TUICallKitServer.init() メソッドが正常に実行されたことを確認してください。",
  "can't call yourself": "自分に電話をかけることができません",
  "accept-error": "接続できませんでした",
  "accept-device-error": "接続できませんでした。発信側デバイスを認証できません",
  "call-error": "通話が開始できませんでした"
}, U = {
  OTHER_SIDE: "other side",
  CANCEL: "cancel",
  OTHER_SIDE_REJECT_CALL: "other side reject call",
  REJECT_CALL: "reject call",
  OTHER_SIDE_LINE_BUSY: "other side line busy",
  IN_BUSY: "in busy",
  CALL_TIMEOUT: "call timeout",
  END_CALL: "end call",
  TIMEOUT: "timeout",
  KICK_OUT: "kick out",
  CALLER_CALLING_MSG: "caller calling message",
  CALLER_GROUP_CALLING_MSG: "wait to be called",
  CALLEE_CALLING_VIDEO_MSG: "callee calling video message",
  CALLEE_CALLING_AUDIO_MSG: "callee calling audio message",
  NO_MICROPHONE_DEVICE_PERMISSION: "no microphone access",
  NO_CAMERA_DEVICE_PERMISSION: "no camera access",
  EXIST_GROUP_CALL: "exist group call",
  LOCAL_NETWORK_IS_POOR: "The network is poor during your current call",
  REMOTE_NETWORK_IS_POOR: "The other user network is poor during the current call"
}, Ge = {
  en: ut,
  "zh-cn": It,
  ja_JP: Ct
};
function y(r) {
  var i;
  const e = A.getData(n.CALL, a.LANGUAGE);
  for (const o in Ge)
    if (o === e) {
      const l = Ge[o];
      for (const s in l)
        if (s === r)
          return l[s];
    }
  const t = (i = r.en) == null ? void 0 : i.key;
  return console.error(`${a.PREFIX}translation is not found: ${r}.`), t;
}
const ce = typeof wx < "u" && typeof wx.getSystemInfoSync == "function" && !!wx.getSystemInfoSync().fontSizeSetting, ke = typeof uni < "u" && typeof uni > "u", Fe = ce || ke, Ye = typeof uni < "u", He = function() {
  return (typeof uni < "u" || typeof window < "u") && !Fe;
}(), Et = function() {
  return ce ? wx : Ye ? uni : window;
}(), V = He && window && window.navigator && window.navigator.userAgent || "", ht = /Android/i.test(V), dt = /(?:Windows Phone)/.test(V), Lt = /(?:SymbianOS)/.test(V), gt = /iPad/i.test(V) || /iPhone/i.test(V) || /iPod/i.test(V), xe = ht || dt || Lt || gt, Be = He && !xe, ft = Be && V.includes("Windows NT"), Dt = Be && V.includes("Mac");
let We = class te {
  constructor() {
    this.global = Et, this.isPC = !1, this.isH5 = !1, this.isWeChat = !1, this.isApp = !1, this.isUniPlatform = !1, this.isOfficial = !1, this.isWIN = !1, this.isMAC = !1, this.initEnv();
  }
  /**
   * 获取 TUIGlobal 实例
   * @returns {TUIGlobal}
  */
  static getInstance() {
    return te.instance || (te.instance = new te()), te.instance;
  }
  initEnv() {
    this.isPC = Be, this.isH5 = xe, this.isWeChat = ce, this.isApp = ke && !ce, this.isUniPlatform = Ye, this.isWIN = ft, this.isMAC = Dt;
  }
  initOfficial(e) {
    this.isOfficial = e === 1400187352 || e === 1400188366;
  }
};
const Ue = function(r) {
  return typeof r === a.UNDEFINED;
}, Je = function(r) {
  if (typeof r !== a.OBJECT || r === null)
    return !1;
  const e = Object.getPrototypeOf(r);
  if (e === null)
    return !0;
  let t = e;
  for (; Object.getPrototypeOf(t) !== null; )
    t = Object.getPrototypeOf(t);
  return e === t;
}, ze = function(r) {
  return typeof Array.isArray === a.FUNCTION ? Array.isArray(r) : Object.prototype.toString.call(r).match(/^\[object (.*)\]$/)[1].toLowerCase() === a.ARRAY;
}, _e = function(r) {
  return typeof r === a.STRING;
}, _t = function(r) {
  return typeof r === a.BOOLEAN;
}, qe = function(r) {
  return (
    // eslint-disable-next-line
    r !== null && (typeof r === a.NUMBER && !isNaN(r - 0) || typeof r === a.OBJECT && r.constructor === Number)
  );
};
function pt(r) {
  const e = Math.floor(r / 3600), t = Math.floor(r % 3600 / 60), i = Math.floor(r % 60);
  let o = e > 9 ? `${e}` : `0${e}`;
  return o += t > 9 ? `:${t}` : `:0${t}`, o += i > 9 ? `:${i}` : `:0${i}`, o;
}
function Me(r) {
  return (r == null ? void 0 : r.message.indexOf("is ongoing, please avoid repeated calls")) !== -1;
}
function St(r) {
  const { message: e } = r;
  return e.indexOf("NotAllowedError: Permission denied") !== -1;
}
function he() {
  return Date.now();
}
const Bt = function(r) {
  return typeof r === a.FUNCTION;
}, Ut = () => {
  if (We.getInstance().isWeChat)
    return "zh-cn";
  const r = ((navigator == null ? void 0 : navigator.language) || (navigator == null ? void 0 : navigator.userLanguage) || "").substr(0, 2);
  let e = "en";
  switch (r) {
    case "zh":
      e = "zh-cn";
      break;
    case "ja":
      e = "ja_JP";
      break;
    default:
      e = "en";
  }
  return e;
}, wt = function(r) {
  return Object.prototype.toString.call(r).match(/^\[object (.*)\]$/)[1].toLowerCase();
};
function Ot(r, e, t) {
  if (!r.hasOwnProperty(e))
    return r;
  const i = {};
  return Object.keys(r).forEach((o) => {
    o === e ? i[t] = r[o] : i[o] = r[o];
  }), i;
}
const Rt = "data:audio/mpeg;base64,SUQzAwAAAAAAGFRYWFgAAAAOAAAAVFhYWABpc29taXNvMv/zNGQAAqwAvnihCAADQAF4CUAQAFYAg3Lh8u+XUD5///wx//wQOAhKAgb/////xOoH4g8Hz4Pq8RoAbdTgMsMt9hcb990EP//zNGQQBPDjEgDItAAFWcIoAYoQAN9P/03QQ//umn//91SXL5uXP+pf8WYTvzgJPAQ+p/7f///1//6f///WH///F4BtJhNFkP/zNGQGA/jjNADHiAAEQDJcAYkQAGWrn6vw6ljfPtj/////////9Pv9sL/mL/QezSepgwrimv07//////y3u602OiyhOYb+LP/zNGQIBKTBKADoCACDoCZMAckAAKHKCUIAFsqGZXtSZ/////////Sn/Vy3nVUOJBqSX2UAkQxBddzv//////yq3lcgaTmTQ//zNGQHA9SrJgA8AliD4C5IAApYAKh3FKlMunKHm8H/2//77vkdqB2xfsXaHiDKBGtFKqONF3/////Z9VXClT5ND+syHkjBq//zNGQLBITJIAA8AmQEiDI4AAjSAGa1Vffm3ff/1/0//11tvZpAaIw3dBiIrjJgHQrGVWmdBU1f/////oDqEKrV1OpBUTjQtv/zNGQHAsjDKAAwAl4D0Co8AAmCBHIQNtld6fm0+/VigZzuMnGZlkAMLMJFv/////33UIWeFQkKsaceBsangecHzYXKI//////zNGQUA4QjKAA3CAID8CpEABMCBPfuStx4FQVHYMgKcO6jIJh//////9uIlspQkGQ2YyZscAV83Bv/////ncL6BEiWHyA2K//zNEQbAogfJgAx5hAEwDJcCAsEBtICgF3/////WJaIuuqMCCVGucgkrtwiwBO//////pW4YFRWQhaRRhZZnVwGhf////+ocv/zNEQmApgVJAANjwAF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hlL/f/7FGQCgAB5FF2GBKAADYOrUMEIAAGod2YcVoAANI6rg4pQAEZrqH8GxT/UqjT/+aDlf/6dvj/r/4+rR//UH//+wTMuo///86//9QGR//+wCCxv//+MCD//BP//oAIP///7FGQFAABgEdsNFKAAC2I68KOcAAMggWoYVQAAP46tAwQgAMzq//QwCv//4WM/+a0//YWHBbCL/5Hi/IAIkheLBSvsvr6F98kyv/4Zg7A3/0+pcfN//8bL5ar/+8wV/v/7FGQCgACDFF0GFKAADkQLYMCIAAGod2occoAANg7rw4pQAKbXi7oTBez1IPl9X/4G2b//1b7/r6/a/Gy//6HAX//+gDAv///nHf/xoBf//hF////ILP0V//lQuP//qP/7FGQDj/BVHVmBQC2QC6O6wDQHsgGEd2gUI4AAMA7sAopQAE8l+F//2DK3//y4f+Bj5j/+oX//8FpP///x0n//GAf//8Kf///xIcrp/ZHCA4SBM2nH8U7C55TDl+3X6P/7FGQKAADZI1uGFOAAEoRrMMKUAAGQd24cUQAANQ7sQ44gAHOZwyYabiX/9COkKb/T6rj9/09fUt+LGTgn/8YALf/+g43///kFf/zgX///UK////hxPTX/+4Sz//+sR//7FGQEA7BbHdmBoC2QDSEL3gADCQGgAXyUIQAAMw7rwpRwAK/hAeAAAAdAAAAAHQz///6wB/xxxyrjsayv6H/+r/+aBD//+Nm///8QulX+1VhmOIUu/+2UD0jR2CVfp//7FGQIgADVI1uGCOACD+RrYMCIAAGcd2ocE4AAMw7sQ4RQAGP+f8eIEjMMke//iRoP//tvp+v/Unyv4pqf/5n//84CQx///0FRv/+K///C3///6gKLdKr//EJ//9QHx//7FGQED/BSHdkBQBWQC4PKwCgHsgFYR2wUI4AANA7sAopQAD5hv/6Br//+SDvyge2n/+gP//8ISf/w9t//oDv//8K///8ggL6a+nTBTVf043E0UOgZIIdw1v/9FHfE3//7FGQLAADOJFuGCKACEQQLMMEIAAGcH3acIQAAMw6sA4pQAMSEikv/yOCn/6frj7f/X4/wQDrJoAtoYAHpR1+Af8N//Jf/4Z//+Mb///wg/tJV/V+ocf//4dDb4Wv/9//7FGQGj/BXHdiBoC2QDCPK0BwFsgGEd2gUUoAANY8rgopQAAn//+o+W+Egw+n/+cBv//wCFP///Gv//Ewg3//wi////mBOtfk5EhcRcQf3fTKYrCVYl4JHN6/2VU+W+P/7FGQMAADTI1qGFOACE0QLAMKUAAGgSXK8IoAAL46sQ45QALyE//fCbBFxB/9fobDMv6f8pfg+oLgcED//Dr7//UBR//yv/6HBOv//wpv///ElAAgMAH+vqAy/Chf/6//7FGQGi/BoElwgoDugC6PKwBwCsgF8R2YUdQAAMIirwo5wAP/6gAf//UmMfURwD//MAJP//+A8NLP+n/9BwFp///qIf/rdQv/WBxhIsF2/ymU1CVYbSJQIf2aNBT/1cP/7FEQMAACqFFoGHOAAHAR7IMKoAEHoUXAYIoAAN4ouwwJQAJMo4L+/GGRO5GDSsD6QvjG9fNboTfJPksA//C1e/+mM1DFieDM2ev6P/znv/TTUFWfBvry+rRX//Av//f/7FGQCj/BsHdqHCOAADOO64OKcAAFoeWYGgFZALo8rAFAeyU0FoaSv//8eb//BP//oBxb///mikv//l3//6goCl9xsv//QB///wDBOsgH11f/Lut0AUMOtP//x9gABgP/7FGQHg7BiHVoAIDuiDKO7KBQCsoFMR3ShAPBQLA7rwFAeyAA//w9f//wv8E4XP9PQKb34R//k//6gO///wIPbwsWVCQAH+vqEz/BaM//J//ooLn//zANEjecHf/1CHf/7FGQOD/BhEduo4DugDAO60CgHsgGAd2YFAazAMo8rQKAdmECUIWv//+cP//ygIPB+LdP//4XGHQKLSAB8sp9///gRz/1f/0BL//6gRf///qIW6d9Kj0GAOV6X4woKy//7FGQTgABrEV4lBEAADKO68KOcAAP0jWwYVQAAYxCsQwpQAXAtahrDftmZs3zB+574qD6cse/9MRcBIeDP8bl0EsFxX9dkG+oozcPjTz5K/v8wMJ//8BHT///QS//oA//7FGQID5BmHVsHHKAADWOq8OOIAAF0d2QGgFZAKQ7r1KAKyFl//6O3///KF8x//UG+///qE2NPghk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gAC8I9oGFUACFCRrAMOUAAJIUXAYU4AAPpAtAwQgAOWZn/8KOPMVb/XXQWxTFf/p5wyr5/hv+vVxBwpl/lczKCRhKsS/9enR/+DOzgv/14vNiP1/8nxOlf/48P/7FGQBj/BgEdqHHUAAC+O68OUIAAGYd2wUc4AANg7sAo5wAC9v//hIJj3/mv/54F///4sT///7D//zwdf//guIN///yrf/qKwgMb//wr///6Djqv/xCaaXKP/ppPhnF//7FEQGAACTFFsGHOAAE6O7YMCcAAHgS3QYIQAAOgluwwQgAOJT/4Y+op/+GTf/KZTUJcNpEp//T0Ic7ngQ//RwkEyf0+pcee2/BXfu//ZwUzf6fUuPPbfiXPbq//iQCv/7FGQCCfBpHdqHFOAADWOq4OUUAAF8d2qgFEoALQjrQAOJQFb//mgr///8o3/6HAr///CD///+NflUKoAz///ED9f//zjSoQN//6BhH/wW703//B8Dka3//8VurAAMAP/7FGQHD7BWHVoAQDswDEOrGAgCsgFIR24AAOEANI7sAAAIIAP/8Bb//4dvhKhPTt/80KM3/wXqBN//6g///16AQh69aqw3G/6/5LEHT//+Qf/+YBKt//6Y7T/x8M//yv/7FGQNj/BiHdmADRLQDGO6wDQHsgFsd2IGgLZAMQ7rQNAeyIQP//6wg0fhRv/1mQLN///kgf+B5ar/+4S//+gFF//hzs//j4g///CTf//+EfMf83FZYDzhSL86ui0F+f/7FGQTAABcEdsFFKAADOO68KOUAAPkjWwYdQAAVBGsgwpQAQBawuFYDq/7TfrP4+LkRyRyr/8LYRr/0+NLg6Tfr0/NJzlKyxa42v6c8KFwOMLjHrxdn4zEPgqSLBOuzf/7FGQKgAC8FVuGHUAAFsKK8MOcAAF4A3CcAQAoMYBqQ4AAABE+n/8TlxQXC3/NyligMxJw2zb4osIIuKrAH+c4H/83QUFBcgrxKCrlHvg0DT//iIO1TEFNRTMuMTAwVQ==";
class Nt {
  constructor() {
    this._bellContext = null, this._isMuteBell = !1, this._calleeBellFilePath = ye, this._callRole = m.UNKNOWN, this._callStatus = d.IDLE, this._handleAudioInterruptionBegin = async () => {
      await this.stop();
    }, this._handleAudioInterruptionEnd = async () => {
      this._callStatus !== d.CALLING ? await this.stop() : await this.play();
    }, this._bellContext = wx.createInnerAudioContext(), this._addListenBellContextEvent(), this._bellContext.loop = !0;
  }
  setBellSrc() {
    const e = wx.getFileSystemManager();
    try {
      let t = Rt;
      this._callRole === m.CALLEE && (t = this._calleeBellFilePath || ye), e.readFileSync(t, "utf8", 0), this._bellContext.src = t;
    } catch (t) {
      console.warn(`${a.PREFIX}Failed to setBellSrc, ${t}`);
    }
  }
  setBellProperties(e) {
    this._callRole = e.callRole || this._callRole, this._callStatus = e.callStatus || this._callStatus, this._calleeBellFilePath = e.calleeBellFilePath || this._calleeBellFilePath, this._isMuteBell = Ue(e.isMuteBell) ? this._isMuteBell : e.isMuteBell;
  }
  async play() {
    try {
      if (this._callStatus !== d.CALLING)
        return;
      this.setBellSrc(), this._callRole === m.CALLEE && !this._isMuteBell && await this._bellContext.play(), this._callRole === m.CALLER && await this._bellContext.play();
    } catch (e) {
      console.warn(`${a.PREFIX}Failed to play audio file, ${e}`);
    }
  }
  async stop() {
    try {
      this._bellContext.stop();
    } catch (e) {
      console.warn(`${a.PREFIX}Failed to stop audio file, ${e}`);
    }
  }
  async setBellMute(e) {
    this._callStatus !== d.CALLING && this._callRole !== m.CALLEE || (e ? await this.stop() : await this.play());
  }
  destroy() {
    try {
      this._isMuteBell = !1, this._calleeBellFilePath = "", this._callRole = m.UNKNOWN, this._callStatus = d.IDLE, this == null || this._removeListenBellContextEvent(), this._bellContext.destroy(), this._bellContext = null;
    } catch (e) {
      console.warn(`${a.PREFIX}Failed to destroy, ${e}`);
    }
  }
  _addListenBellContextEvent() {
    wx.onAudioInterruptionBegin(this._handleAudioInterruptionBegin), wx.onAudioInterruptionEnd(this._handleAudioInterruptionEnd);
  }
  _removeListenBellContextEvent() {
    wx.offAudioInterruptionBegin(this._handleAudioInterruptionBegin), wx.offAudioInterruptionEnd(this._handleAudioInterruptionEnd);
  }
}
function B() {
  return function(r, e, t) {
    const i = t.value, o = /* @__PURE__ */ new Set();
    return t.value = async function(...l) {
      var s, u;
      if (o.has(this)) {
        console.warn(`${a.PREFIX}previous ${e}() is ongoing, please avoid repeated calls`), (u = (s = this == null ? void 0 : this.getTUICallEngineInstance()) == null ? void 0 : s.reportLog) == null || u.call(s, {
          name: "TUICallKit.avoidRepeatedCall.fail",
          data: { name: e },
          error: `previous ${e}() is ongoing`
        });
        return;
      }
      try {
        o.add(this);
        const c = await i.apply(this, l);
        return o.delete(this), c;
      } catch (c) {
        throw o.delete(this), c;
      }
    }, t;
  };
}
const ee = a.PREFIX + "API";
function G(r) {
  return function(e, t, i) {
    let o = i.value;
    return i.value = function(...l) {
      return Tt.call(this, r, l, t), o.apply(this, l);
    }, i;
  };
}
function Tt(r, e, t) {
  try {
    if (e[0].SDKAppID || (r = Ot(r, "SDKAppID", "sdkAppID")), ze(r))
      for (let i = 0; i < r.length; i++)
        Qe.call(this, {
          ...r[i],
          value: e[i],
          name: t
        });
    else
      for (const i in r)
        r.hasOwnProperty(i) && Qe.call(this, {
          ...r[i],
          value: e[0][i],
          name: t,
          key: i
        });
  } catch (i) {
    throw console.error(i), i;
  }
}
function Qe({ required: r, rules: e, range: t, value: i, allowEmpty: o, name: l, key: s }) {
  if (Ue(i)) {
    if (r)
      throw new Error(`${ee}<${l}>: ${s} is required.`);
    return;
  }
  const u = e.some((E) => E === wt(i));
  let c = "";
  if (!u) {
    for (let E = 0; E < e.length; E++) {
      let I = e[E];
      I = I.replace(I[0], I[0].toUpperCase()), c += `${I}/`;
    }
    throw c = c.substring(0, c.length - 1), new Error(`${ee}<${l}>: ${s} must be ${c}, current ${s} is ${typeof i}.`);
  }
  if (o === !1 && _e(i) && i.trim() === "")
    throw new Error(`${ee}<${l}>: ${s} is blank.`);
  if (ze(t) && t && t.indexOf(i) === -1)
    throw new Error(`${ee}<${l}>: ${s} error, only be ${t}, current ${s} is ${i}.`);
  if (_e(t) && t.indexOf("~") !== -1) {
    const E = t.split("~");
    if (i < +E[0] || i > +E[1] || qe(i) && Number.isNaN(i))
      throw new Error(`${ee}<${l}>: ${s} error, only be ${t}, current ${s} is ${i}.`);
  }
}
const F = {
  init: {
    SDKAppID: {
      required: !0,
      rules: [a.NUMBER],
      allowEmpty: !1
    },
    userID: {
      required: !0,
      rules: [a.STRING],
      allowEmpty: !1
    },
    userSig: {
      required: !0,
      rules: [a.STRING],
      allowEmpty: !1
    },
    tim: {
      required: !1,
      rules: [a.OBJECT]
    }
  },
  call: {
    userID: {
      required: !0,
      rules: [a.STRING],
      allowEmpty: !1
    },
    type: {
      required: !0,
      rules: [a.NUMBER],
      range: [1, 2],
      allowEmpty: !1
    },
    roomID: {
      required: !1,
      rules: [a.NUMBER],
      // 仅支持数字房间号, 后续会支持字符串房间号
      range: `0~${Te}`,
      allowEmpty: !1
    },
    strRoomID: {
      required: !1,
      rules: [a.STRING],
      allowEmpty: !0
    },
    userData: {
      required: !1,
      rules: [a.STRING],
      allowEmpty: !1
    },
    timeout: {
      required: !1,
      rules: [a.NUMBER],
      allowEmpty: !1
    }
  },
  groupCall: {
    userIDList: {
      required: !0,
      rules: [a.ARRAY],
      allowEmpty: !1
    },
    type: {
      required: !0,
      rules: [a.NUMBER],
      range: [1, 2],
      allowEmpty: !1
    },
    groupID: {
      required: !0,
      rules: [a.STRING],
      allowEmpty: !1
    },
    roomID: {
      required: !1,
      rules: [a.NUMBER],
      // 仅支持数字房间号, 后续会支持字符串房间号
      range: `0~${Te}`,
      allowEmpty: !1
    },
    strRoomID: {
      required: !1,
      rules: [a.STRING],
      allowEmpty: !0
    },
    timeout: {
      required: !1,
      rules: [a.NUMBER],
      allowEmpty: !1
    },
    userData: {
      required: !1,
      rules: [a.STRING],
      allowEmpty: !1
    },
    offlinePushInfo: {
      required: !1,
      rules: [a.OBJECT],
      allowEmpty: !1
    }
  },
  joinInGroupCall: {
    type: {
      required: !0,
      rules: [a.NUMBER],
      range: [1, 2],
      allowEmpty: !1
    },
    groupID: {
      required: !0,
      rules: [a.STRING],
      allowEmpty: !1
    },
    roomID: {
      required: !0,
      rules: [a.NUMBER],
      allowEmpty: !1
    },
    strRoomID: {
      required: !1,
      rules: [a.STRING],
      allowEmpty: !0
    }
  },
  inviteUser: {
    userIDList: {
      required: !0,
      rules: [a.ARRAY],
      allowEmpty: !1
    }
  },
  setSelfInfo: {
    nickName: {
      required: !1,
      rules: [a.STRING],
      allowEmpty: !1
    },
    avatar: {
      required: !1,
      rules: [a.STRING],
      allowEmpty: !1
    }
  },
  enableFloatWindow: [
    {
      key: "enable",
      required: !1,
      rules: [a.BOOLEAN],
      allowEmpty: !1
    }
  ],
  enableAIVoice: [
    {
      key: "enable",
      required: !0,
      rules: [a.BOOLEAN],
      allowEmpty: !1
    }
  ],
  enableMuteMode: [
    {
      key: "enable",
      required: !0,
      rules: [a.BOOLEAN],
      allowEmpty: !1
    }
  ],
  setCallingBell: [
    {
      key: "filePath",
      required: !1,
      rules: [a.STRING],
      allowEmpty: !0
    }
  ],
  setLanguage: [
    {
      key: "language",
      required: !0,
      rules: [a.STRING],
      allowEmpty: !1
    }
  ],
  setVideoDisplayMode: [
    {
      key: "displayMode",
      required: !0,
      rules: [a.STRING],
      range: [re.CONTAIN, re.COVER, re.FILL],
      allowEmpty: !1
    }
  ],
  setVideoResolution: [
    {
      key: "resolution",
      required: !0,
      rules: [a.STRING],
      range: [oe.RESOLUTION_1080P, oe.RESOLUTION_480P, oe.RESOLUTION_720P],
      allowEmpty: !1
    }
  ]
};
function Ce(r) {
  return function(e, t, i) {
    let o = i.value;
    return i.value = function(...l) {
      return mt.call(this, r, l, t), o.apply(this, l);
    }, i;
  };
}
function mt(r) {
  if (r != null && r.engineInstance && !this._tuiCallEngine) {
    const e = `${a.PREFIX} ${y("TUICallKit init is not complete")}`;
    throw console.error(e), e;
  }
}
function ue(r) {
  if (typeof r != "object" || r === null)
    return r;
  let e = Array.isArray(r) ? [] : {};
  for (let t in r)
    r.hasOwnProperty(t) && (e[t] = ue(r[t]));
  return e;
}
class Gt {
  constructor() {
    this.defaultStore = {
      callStatus: d.IDLE,
      callRole: m.UNKNOWN,
      callMediaType: L.UNKNOWN,
      localUserInfo: { userId: "" },
      localUserInfoExcludeVolume: { userId: "" },
      remoteUserInfoList: [],
      remoteUserInfoExcludeVolumeList: [],
      callerUserInfo: { userId: "" },
      isGroup: !1,
      callDuration: "00:00:00",
      // 通话时长
      callTips: "",
      // 通话提示的信息. 例如: '等待谁接听', 'xxx 拒绝通话', 'xxx 挂断通话'
      toastInfo: { text: "" },
      // 远端用户挂断、拒绝、超时、忙线等的 toast 提示信息
      isMinimized: !1,
      // 用来记录当前是否悬浮窗模式
      enableFloatWindow: !1,
      // 开启/关闭悬浮窗功能，设置为false，通话界面左上角的悬浮窗按钮会隐藏
      bigScreenUserId: "",
      // 当前大屏幕显示的 userID 用户
      language: Ut(),
      // en, zh-cn
      isClickable: !1,
      // 是否可点击, 用于按钮增加 loading 效果，不可点击
      deviceList: { cameraList: [], microphoneList: [], currentCamera: {}, currentMicrophone: {} },
      showPermissionTip: !1,
      netWorkQualityList: [],
      // 显示网络状态差的提示
      isMuteSpeaker: !1,
      groupID: "",
      roomID: 0,
      roomIdType: 0,
      cameraPosition: ne.FRONT,
      // 前置或后置，值为front, back
      groupCallMembers: [],
      // chat 群会话在的通话中的成员
      // TUICallKit 组件上的属性
      displayMode: re.COVER,
      // 设置预览远端的画面显示模式
      videoResolution: oe.RESOLUTION_480P,
      showSelectUser: !1,
      // 小程序相关属性
      pusher: {},
      player: [],
      isEarPhone: !1,
      // 是否是听筒, 默认: false
      pusherId: a.INITIAL_PUSHER,
      // 重新渲染 live-Pusher 的标识位
      // 是否开启虚拟背景, 目前仅 web 支持
      isShowEnableVirtualBackground: !1,
      // 是否显示虚拟背景图标, 默认: false
      enableVirtualBackground: !1,
      // 是否开启虚拟背景， 默认: false
      // customUIConfig
      customUIConfig: {
        button: {},
        viewBackground: {},
        layoutMode: Ke.RemoteInLargeView
      }
    }, this.store = ue(this.defaultStore), this.prevStore = ue(this.defaultStore);
  }
  update(e, t) {
    switch (e) {
      case a.CALL_TIPS:
        const i = this.getData(e);
        this.prevStore[e] = i;
      default:
        this.store[e] = t;
    }
  }
  getPrevData(e) {
    return e ? this.prevStore[e] : this.prevStore;
  }
  getData(e) {
    return e ? this.store[e] : this.store;
  }
  // reset call store
  reset(e = []) {
    e.length === 0 && (e = Object.keys(this.store));
    const t = e.reduce((i, o) => ({ ...i, [o]: this.defaultStore[o] }), {});
    this.store = {
      ...this.defaultStore,
      ...this.store,
      ...t
    };
  }
}
let Ee = class ae {
  constructor() {
    this.timerId = -1, this.storeMap = {
      [n.CALL]: new Gt()
    }, this.task = {};
  }
  /**
   * 获取 TUIStore 实例
   * @returns {TUIStore}
  */
  static getInstance() {
    return ae.instance || (ae.instance = new ae()), ae.instance;
  }
  /**
   * UI 组件注册监听回调
   * @param {StoreName} storeName store 名称
   * @param {IOptions} options 监听信息
   * @param {Object} params 扩展参数
   * @param {String} params.notifyRangeWhenWatch 注册时监听时的通知范围, 'all' - 通知所有注册该 key 的监听; 'myself' - 通知本次注册该 key 的监听; 默认不通知
  */
  watch(e, t, i) {
    this.task[e] || (this.task[e] = {});
    const o = this.task[e];
    Object.keys(t).forEach((l) => {
      const s = t[l];
      o[l] || (o[l] = /* @__PURE__ */ new Map()), o[l].set(s, 1);
      const { notifyRangeWhenWatch: u } = i || {};
      if (u === a.ALL && this.notify(e, l), u === a.MYSELF) {
        const c = this.getData(e, l);
        s.call(this, c);
      }
    });
  }
  /**
   * UI 取消组件监听回调
   * @param {StoreName} storeName store 名称
   * @param {IOptions} options 监听信息,包含需要取消的回掉等
   */
  unwatch(e, t) {
    if (!this.task[e])
      return;
    const i = this.task[e];
    Object.keys(t).forEach((o) => {
      i[o].delete(t[o]);
    });
  }
  /**
   * 通用 store 数据更新，messageList 的变更需要单独处理
   * @param {StoreName} storeName store 名称
   * @param {string} key 变更的 key
   * @param {unknown} data 变更的数据
  */
  update(e, t, i) {
    var o;
    (_e(i) || qe(i) || _t(i)) && this.storeMap[e].store[t] === i || ((o = this.storeMap[e]) == null || o.update(t, i), this.notify(e, t));
  }
  /**
   * 获取 Store 的上一个状态值
   * @param {StoreName} storeName store 名称
   * @param {string} key 待获取的 key
   * @returns {Any}
  */
  getPrevData(e, t) {
    var i;
    return (i = this.storeMap[e]) == null ? void 0 : i.getPrevData(t);
  }
  /**
   * 获取 Store 数据
   * @param {StoreName} storeName store 名称
   * @param {string} key 待获取的 key
   * @returns {Any}
  */
  getData(e, t) {
    var i;
    return (i = this.storeMap[e]) == null ? void 0 : i.getData(t);
  }
  /**
   * UI 组件注册监听回调
   * @param {StoreName} storeName store 名称
   * @param {string} key 变更的 key
  */
  notify(e, t) {
    if (!this.task[e])
      return;
    const i = this.task[e];
    if (i[t]) {
      const o = i[t], l = this.getData(e, t);
      for (const [s] of o.entries())
        s.call(this, l);
    }
  }
  reset(e, t = [], i = !1) {
    if (e in this.storeMap) {
      const o = this.storeMap[e];
      t.length === 0 && (t = Object.keys(o == null ? void 0 : o.store)), o.reset(t), i && t.forEach((l) => {
        this.notify(e, l);
      });
    }
  }
  // 批量修改多个 key-value
  updateStore(e, t) {
    const i = t || n.CALL;
    Object.keys(e).forEach((o) => {
      this.update(i, o, e[o]);
    });
  }
};
const p = Ee.getInstance();
function pe(r, e) {
  const t = {
    userId: r,
    nick: "",
    avatar: "",
    remark: "",
    displayUserInfo: "",
    isAudioAvailable: !1,
    isVideoAvailable: !1,
    isEnter: !1,
    domId: e || r
  };
  return e ? t : { ...t, isEnter: !1 };
}
async function Ft(r, e) {
  var i, o, l, s, u;
  let t = pe(r, a.LOCAL_VIDEO);
  try {
    if (!e)
      return t;
    const c = await e.getMyProfile(), E = p == null ? void 0 : p.getData(n.CALL, a.LOCAL_USER_INFO);
    return (c == null ? void 0 : c.code) === 0 && (t = {
      ...t,
      ...E,
      userId: (i = c == null ? void 0 : c.data) == null ? void 0 : i.userID,
      nick: (o = c == null ? void 0 : c.data) == null ? void 0 : o.nick,
      avatar: (l = c == null ? void 0 : c.data) == null ? void 0 : l.avatar,
      displayUserInfo: ((s = c == null ? void 0 : c.data) == null ? void 0 : s.nick) || ((u = c == null ? void 0 : c.data) == null ? void 0 : u.userID)
    }), t;
  } catch (c) {
    return console.error(`${a.PREFIX}getMyProfile failed, error: ${c}.`), t;
  }
}
async function le(r, e) {
  let t = r.map((i) => pe(i));
  try {
    if (!e)
      return t;
    const i = await e.getFriendProfile({ userIDList: r });
    if (i.code === 0) {
      const { friendList: o = [], failureUserIDList: l = [] } = i.data;
      let s = l.map((I) => I.userID);
      if (l.length > 0) {
        const I = await e.getUserProfile({ userIDList: l.map((g) => g.userID) });
        (I == null ? void 0 : I.code) === 0 && (s = (I == null ? void 0 : I.data) || []);
      }
      const u = p == null ? void 0 : p.getData(n.CALL, a.REMOTE_USER_INFO_LIST), c = o.map((I) => I.userID), E = s.map((I) => I.userID);
      t = r.map((I) => {
        var q, j, X, Z, H, we, Oe;
        const g = pe(I), _ = c.indexOf(I), O = E.indexOf(I);
        let N = "", M = "", z = "", Q = "";
        _ !== -1 && (N = ((q = o[_]) == null ? void 0 : q.remark) || "", M = ((X = (j = o[_]) == null ? void 0 : j.profile) == null ? void 0 : X.nick) || "", z = N || M || g.userId || "", Q = ((H = (Z = o[_]) == null ? void 0 : Z.profile) == null ? void 0 : H.avatar) || ""), O !== -1 && (M = ((we = s[O]) == null ? void 0 : we.nick) || "", z = M || g.userId || "", Q = ((Oe = s[O]) == null ? void 0 : Oe.avatar) || "");
        const w = u.find((Xe) => Xe.userId === I) || {};
        return { ...g, ...w, remark: N, nick: M, displayUserInfo: z, avatar: Q };
      });
    }
    return t;
  } catch (i) {
    return console.error(`${a.PREFIX}getRemoteUserProfile failed, error: ${i}.`), t;
  }
}
function K(r, e, t) {
  const i = p.getData(n.CALL, a.IS_GROUP);
  let o = `${y(r)}`;
  return i && (o = e ? `${e} ${o}` : o, o = t ? `${o} ${t}` : o), o;
}
function se() {
  const r = p.getData(n.CALL, a.CALL_STATUS);
  if (r === d.IDLE)
    return R.IDLE;
  const e = p.getData(n.CALL, a.IS_GROUP);
  if (r === d.CALLING)
    return e ? R.DIALING_GROUP : R.DIALING_C2C;
  const t = p.getData(n.CALL, a.CALL_MEDIA_TYPE);
  return e ? t === L.AUDIO ? R.CALLING_GROUP_AUDIO : R.CALLING_GROUP_VIDEO : t === L.AUDIO ? R.CALLING_C2C_AUDIO : R.CALLING_C2C_VIDEO;
}
async function Mt(r, e, t, i) {
  let o = [];
  try {
    const l = await e.getGroupMemberList({ groupID: r, count: t, offset: i });
    if (l.code === 0)
      return l.data.memberList || o;
  } catch (l) {
    return console.error(`${a.PREFIX}getGroupMember failed, error: ${l}.`), o;
  }
}
async function yt(r, e) {
  let t = {};
  try {
    return (await e.getGroupProfile({ groupID: r })).data.group || t;
  } catch (i) {
    return console.warn(`${a.PREFIX}getGroupProfile failed, error: ${i}.`), t;
  }
}
function je(r, e) {
  r === 0 && e ? (p.update(n.CALL, a.ROOM_ID, e), p.update(n.CALL, a.ROOM_ID_TYPE, De.STRING_ROOM_ID)) : (p.update(n.CALL, a.ROOM_ID, r), p.update(n.CALL, a.ROOM_ID_TYPE, De.NUMBER_ROOM_ID));
}
function v(r) {
  return (r == null ? void 0 : r.data) || {};
}
function de(r) {
  if (r.length === 0)
    return;
  let e = p.getData(n.CALL, a.REMOTE_USER_INFO_LIST);
  r.forEach((t) => {
    e = e.filter((i) => i.userId !== t);
  }), p.update(n.CALL, a.REMOTE_USER_INFO_LIST, e), p.update(n.CALL, a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, e);
}
function Le(r, e, t) {
  if (St(r)) {
    let i = "";
    e === L.AUDIO && (i = K(U.NO_MICROPHONE_DEVICE_PERMISSION)), e === L.VIDEO && (i = K(U.NO_CAMERA_DEVICE_PERMISSION)), i && p.update(n.CALL, a.TOAST_INFO, { text: i, type: a.ERROR }), console.error(`${a.PREFIX}call failed, error: ${r.message}.`);
  }
}
function b(r, e) {
  let t = p.getData(n.CALL, a.LOCAL_USER_INFO);
  e === a.AUDIO && (t = { ...t, isAudioAvailable: r }), e === a.VIDEO && (t = { ...t, isVideoAvailable: r }), p.update(n.CALL, a.LOCAL_USER_INFO, t), p.update(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN, t);
}
class Ie {
  static generateTaskID() {
    return this.currentTaskID++;
  }
  /**
   *
   * @param {string} taskName 'interval' 'timeout'
   * @param {function} callback
   * @param {object} options include:
   * @param {number} options.delay millisecond
   * @param {number} options.count 定时器回调执行次数，0 无限次 or n次
   * @param {boolean} options.backgroundTask 在页面静默后是否继续执行定时器
   */
  static run(e = a.TIMEOUT, t, i) {
    e === a.INTERVAL ? i = { delay: 2e3, count: 0, backgroundTask: !0, ...i } : i = { delay: 2e3, count: 0, backgroundTask: !0, ...i }, Je(t) && (i = { ...i, ...t }), Bt(e) && (t = e, e = a.TIMEOUT);
    const o = {
      taskID: this.generateTaskID(),
      loopCount: 0,
      intervalID: null,
      timeoutID: null,
      taskName: e,
      callback: t,
      ...i
    };
    return this.taskMap.set(o.taskID, o), e === a.INTERNAL ? this.interval(o) : this.timeout(o), o.taskID;
  }
  /**
   * 定时循环执行回调函数
   * 可以指定循环的时间间隔
   * 可以指定循环次数
   * @param {object} taskItem
   * @param {function} callback
   * @param {*} delay
   * @param {*} count
   * @returns ID
   */
  static interval(e) {
    const t = () => {
      e.callback(), e.loopCount += 1, this.isBreakLoop(e);
    };
    return e.intervalID = setInterval(t, e.delay);
  }
  /**
   * 延迟执行回调
   * count = 0,循环
   * count = n, 执行n次
   * @param {object} taskItem
   *
   */
  static timeout(e) {
    const t = () => {
      if (e.callback(), e.loopCount += 1, !this.isBreakLoop(e))
        return e.timeoutID = setTimeout(t, e.delay);
    };
    return e.timeoutID = setTimeout(t, e.delay);
  }
  static hasTask(e) {
    return this.taskMap.has(e);
  }
  static clearTask(e) {
    if (!this.taskMap.has(e))
      return !0;
    const { intervalID: t, timeoutID: i, onVisibilitychange: o } = this.taskMap.get(e);
    return t && clearInterval(t), i && clearTimeout(i), o && document.removeEventListener("visibilitychange", o), this.taskMap.delete(e), !0;
  }
  /**
   * 1. 如果已移除出定时队列，退出当前任务
   * 2. 如果当前任务已满足次数限制，则退出当前任务
   * @param {object} taskItem
   * @returns
   */
  static isBreakLoop(e) {
    return this.taskMap.has(e.taskID) ? e.count !== 0 && e.loopCount >= e.count ? (this.clearTask(e.taskID), !0) : !1 : !0;
  }
}
Ie.taskMap = /* @__PURE__ */ new Map();
Ie.currentTaskID = 1;
const Qt = function(r) {
  if (r === null || typeof r > "u")
    return !0;
  if (typeof r == "boolean")
    return !1;
  if (typeof r == "number")
    return r === 0;
  if (typeof r == "string" || typeof r == "function" || Array.isArray(r))
    return r.length === 0;
  if (r instanceof Error)
    return r.message === "";
  if (Je(r)) {
    for (const e in r)
      if (Object.prototype.hasOwnProperty.call(r, e))
        return !1;
    return !0;
  }
  return !1;
}, ge = "_local_user_id";
class k {
  constructor() {
    this._viewConfig = {
      viewBackground: {
        local: {},
        remote: {}
      }
    }, this._isSetViewBackgroundConfig = { remote: !1, local: !1 }, this._tuiCallEngine = null, this._tuiStore = null;
  }
  static getInstance() {
    return k.instance || (k.instance = new k()), k.instance;
  }
  _updateViewBackground() {
    var i, o, l;
    const e = (i = this._tuiStore) == null ? void 0 : i.getData(n.CALL, a.CUSTOM_UI_CONFIG), { userId: t } = (o = this._tuiStore) == null ? void 0 : o.getData(n.CALL, a.LOCAL_USER_INFO);
    Object.keys(this._viewConfig.viewBackground.remote).includes(t) && delete this._viewConfig.viewBackground.remote[t], (l = this._tuiStore) == null || l.update(
      n.CALL,
      a.CUSTOM_UI_CONFIG,
      {
        ...e,
        viewBackground: {
          ...this._viewConfig.viewBackground.remote,
          ...this._viewConfig.viewBackground.local
        }
      }
    );
  }
  setEngineInstance(e) {
    this._tuiCallEngine = e;
  }
  setTUIStore(e) {
    this._tuiStore = e;
  }
  updateViewBackgroundUserId(e) {
    var t, i;
    if (e === "local") {
      const { userId: o } = (t = this._tuiStore) == null ? void 0 : t.getData(n.CALL, a.LOCAL_USER_INFO);
      if (Object.keys(this._viewConfig.viewBackground.remote).includes(o) && (delete this._viewConfig.viewBackground.remote[o], this._updateViewBackground()), !this._isSetViewBackgroundConfig.local)
        return;
      const l = this._viewConfig.viewBackground.local, s = l[o] || l[ge];
      l[o] = l[ge], this._viewConfig.viewBackground.local = { [o]: s }, this._updateViewBackground();
    } else {
      let o = this._viewConfig.viewBackground.remote;
      this._isSetViewBackgroundConfig.remote && Object.keys(o).includes("*") && (((i = this._tuiStore) == null ? void 0 : i.getData(n.CALL, a.REMOTE_USER_INFO_LIST)).map((u) => u.userId).forEach((u) => {
        Object.keys(o).includes(u) || (o[u] = o["*"]);
      }), this._viewConfig.viewBackground.remote = o, this._updateViewBackground());
    }
  }
  hideFeatureButton(e) {
    var i, o, l, s, u;
    (o = (i = this._tuiCallEngine) == null ? void 0 : i.reportLog) == null || o.call(i, {
      name: "TUICallKit.hideFeatureButton.start",
      data: { buttonName: e }
    });
    const t = (l = this._tuiStore) == null ? void 0 : l.getData(n.CALL, a.CUSTOM_UI_CONFIG);
    (u = this._tuiStore) == null || u.update(
      n.CALL,
      a.CUSTOM_UI_CONFIG,
      {
        ...t,
        button: {
          ...t.button,
          [e]: { ...((s = t.button) == null ? void 0 : s[e]) || {}, show: !1 }
        }
      }
    );
  }
  setLocalViewBackgroundImage(e) {
    var i, o, l;
    (o = (i = this._tuiCallEngine) == null ? void 0 : i.reportLog) == null || o.call(i, {
      name: "TUICallKit.setLocalViewBackgroundImage.start",
      data: { url: e }
    }), this._isSetViewBackgroundConfig.local = !0;
    let { userId: t } = (l = this._tuiStore) == null ? void 0 : l.getData(n.CALL, a.LOCAL_USER_INFO);
    Qt(t) && (t = ge), this._viewConfig.viewBackground.local = { [t]: e }, this._updateViewBackground();
  }
  setRemoteViewBackgroundImage(e, t) {
    var i, o;
    (o = (i = this._tuiCallEngine) == null ? void 0 : i.reportLog) == null || o.call(i, {
      name: "TUICallKit.setRemoteViewBackgroundImage.start",
      data: { userId: e, url: t }
    }), this._isSetViewBackgroundConfig.remote = !0, e === "*" && (this._viewConfig.viewBackground.remote = {}), this._viewConfig.viewBackground.remote[e] = t, this._updateViewBackground();
  }
  setLayoutMode(e) {
    var i, o;
    (o = (i = this._tuiCallEngine) == null ? void 0 : i.reportLog) == null || o.call(i, {
      name: "TUICallKit.setLayoutMode.start",
      data: { layoutMode: e }
    });
    const t = this._tuiStore.getData(n.CALL, a.CUSTOM_UI_CONFIG);
    this._tuiStore.update(
      n.CALL,
      a.CUSTOM_UI_CONFIG,
      {
        ...t,
        layoutMode: e
      }
    );
  }
  setCameraDefaultState(e) {
    var i, o;
    (o = (i = this._tuiCallEngine) == null ? void 0 : i.reportLog) == null || o.call(i, {
      name: "TUICallKit.setCameraDefaultState.start",
      data: { isOpen: e }
    });
    const t = ue(this._tuiStore.getData(n.CALL, a.CUSTOM_UI_CONFIG));
    Object.keys(t.button).includes(Y.Camera) || (t.button[Y.Camera] = {}), t.button[Y.Camera].state = e ? J.Open : J.Close, this._tuiStore.update(n.CALL, a.CUSTOM_UI_CONFIG, t);
  }
}
const fe = Ee.getInstance();
class x {
  constructor(e) {
    var t, i, o;
    this._callService = e.callService, $.registerEvent(S.TUILogin.EVENT.LOGIN_STATE_CHANGED, S.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS, this), (t = S.TUIChat) != null && t.EVENT && $.registerEvent((i = S.TUIChat.EVENT) == null ? void 0 : i.CHAT_STATE_CHANGED, (o = S.TUIChat.EVENT_SUB_KEY) == null ? void 0 : o.CHAT_OPENED, this), $.registerService(S.TUICalling.SERVICE.NAME, this), $.registerExtension(S.TUIChat.EXTENSION.INPUT_MORE.EXT_ID, this);
  }
  static getInstance(e) {
    return x.instance || (x.instance = new x(e)), x.instance;
  }
  // ================ 【】 ================
  /**
   * message on screen
   * @param {Any} params Parameters for message up-screening
   */
  callTUIService(e) {
    const { message: t } = e || {};
    $.callService({
      serviceName: S.TUIChat.SERVICE.NAME,
      method: S.TUIChat.SERVICE.METHOD.UPDATE_MESSAGE_LIST,
      params: { message: t }
    });
  }
  /**
   * tuicore getExtension
   * @param {String} extensionID extension id
   * @param {Any} params tuicore pass parameters
   * @returns {Any[]} return extension
   */
  onGetExtension(e, t) {
    var i, o;
    if (e === S.TUIChat.EXTENSION.INPUT_MORE.EXT_ID) {
      if ((o = (i = this._callService.getTUICallEngineInstance()) == null ? void 0 : i.reportLog) == null || o.call(i, { name: "TUICallKit.onGetExtension", data: { extensionID: e, params: t } }), Ue(t))
        return [];
      if ([S.TUIChat.TYPE.ROOM, S.TUIChat.TYPE.CUSTOMER_SERVICE].includes(t.chatType))
        return [];
      let l = [];
      const s = {
        weight: 1e3,
        text: "语音通话",
        icon: rt,
        data: {
          name: "voiceCall"
        },
        listener: {
          onClicked: async (c) => await this._handleTUICoreOnClick(c, c.type || L.AUDIO)
        }
      }, u = {
        weight: 900,
        text: "视频通话",
        icon: ot,
        data: {
          name: "videoCall"
        },
        listener: {
          onClicked: async (c) => await this._handleTUICoreOnClick(c, c.type || L.VIDEO)
        }
      };
      return t != null && t.chatType ? l = [s, u] : (!(t != null && t.filterVoice) && l.push(s), !(t != null && t.filterVideo) && l.push(u)), l;
    }
  }
  async onCall(e, t) {
    e === S.TUICalling.SERVICE.METHOD.START_CALL && await this._handleTUICoreOnClick(t, t.type);
  }
  /**
   * tuicore notify event manager
   * @param {String} eventName event name
   * @param {String} subKey sub key
   * @param {Any} options tuicore event parameters
   */
  async onNotifyEvent(e, t, i) {
    var o, l, s, u, c, E, I, g;
    try {
      if (e === S.TUILogin.EVENT.LOGIN_STATE_CHANGED)
        if (t === S.TUILogin.EVENT_SUB_KEY.USER_LOGIN_SUCCESS) {
          const { chat: _, userID: O, userSig: N, SDKAppID: M } = $e.getContext();
          await ((o = this._callService) == null ? void 0 : o.init({ tim: _, userID: O, userSig: N, sdkAppID: M, isFromChat: !0, component: Se.TIM_CALL_KIT })), (l = this._callService) == null || l.setIsFromChat(!0), (s = this._callService) == null || s.setLogLevel(Ve.NORMAL), this._addListenChatEvent();
        } else
          t === S.TUILogin.EVENT_SUB_KEY.USER_LOGOUT_SUCCESS && (this._removeListenChatEvent(), await ((u = this._callService) == null ? void 0 : u.destroyed()));
      if ((c = S.TUIChat) != null && c.EVENT && e === S.TUIChat.EVENT.CHAT_STATE_CHANGED && t === S.TUIChat.EVENT_SUB_KEY.CHAT_OPENED) {
        if ((E = this._callService) == null || E.setCurrentGroupId((i == null ? void 0 : i.groupID) || ""), fe.getData(n.CALL, a.CALL_STATUS) !== d.IDLE)
          return;
        const _ = (I = this._callService) == null ? void 0 : I.getCurrentGroupId(), O = _ ? await this.getGroupAttributes((g = this._callService) == null ? void 0 : g.getTim(), _) : {};
        await this.updateStoreBasedOnGroupAttributes(O);
      }
    } catch (_) {
      console.error(`${a.PREFIX}TUICore onNotifyEvent failed, error: ${_}.`);
    }
  }
  // Handling the chat+call scenario, data required for the joinInGroupCall API: update store / clear relevant store data
  async updateStoreBasedOnGroupAttributes(e) {
    var t, i, o, l;
    (o = (i = (t = this._callService) == null ? void 0 : t.getTUICallEngineInstance()) == null ? void 0 : i.reportLog) == null || o.call(i, {
      name: "TUICallKit.getJoinGroupCallInfo.success",
      data: { groupAttributes: e }
    });
    try {
      const {
        group_id: s = "",
        room_id: u = 0,
        room_id_type: c = 0,
        call_media_type: E = a.UNKNOWN,
        // @ts-ignore
        user_list: I
        // The default value of the user list returned by the background is null
      } = e[a.INNER_ATTR_KIT_INFO] ? JSON.parse(e[a.INNER_ATTR_KIT_INFO]) : {};
      let g = (I || []).map((O) => O.userid);
      g = g.length && await le(g, (l = this._callService) == null ? void 0 : l.getTim());
      const _ = {
        [a.GROUP_ID]: s,
        [a.GROUP_CALL_MEMBERS]: g,
        [a.ROOM_ID]: u,
        [a.CALL_MEDIA_TYPE]: et[E],
        [a.ROOM_ID_TYPE]: c
      };
      fe.updateStore(_, n.CALL);
    } catch (s) {
      console.warn(`${a.PREFIX}updateStoreBasedOnGroupAttributes fail, error: ${s}`);
    }
  }
  // Get group attribute
  async getGroupAttributes(e, t) {
    if (!t)
      return {};
    try {
      const { data: i } = await e.getGroupAttributes({
        groupID: t,
        keyList: []
      });
      return (i == null ? void 0 : i.groupAttributes) || {};
    } catch (i) {
      return console.warn(`${a.PREFIX}getGroupAttributes fail: ${i}`), {};
    }
  }
  // =========================【chat: event listening】=========================
  _addListenChatEvent() {
    var e, t;
    if (!((e = this._callService) != null && e.getTim())) {
      console.warn(`${a.PREFIX}add tim event listener failed, tim is empty.`);
      return;
    }
    (t = this._callService) == null || t.getTim().on(Re.EVENT.GROUP_ATTRIBUTES_UPDATED, this._handleGroupAttributesUpdated, this);
  }
  _removeListenChatEvent() {
    var e, t;
    if (!((e = this._callService) != null && e.getTim())) {
      console.warn(`${a.PREFIX}remove tim event listener failed, tim is empty.`);
      return;
    }
    (t = this._callService) == null || t.getTim().off(Re.EVENT.GROUP_ATTRIBUTES_UPDATED, this._handleGroupAttributesUpdated, this);
  }
  /**
   * chat start audio/video call via click
   * @param {Any} options Parameters passed in when clicking on an audio/video call from chat
   * @param {CallMediaType} type call media type. 0 - audio; 1 - video.
   */
  async _handleTUICoreOnClick(e, t) {
    var i, o;
    try {
      const { groupID: l, userIDList: s = [], ...u } = e;
      l ? await ((i = this._callService) == null ? void 0 : i.groupCall({ groupID: l, userIDList: s, type: t, ...u })) : s.length === 1 && await ((o = this._callService) == null ? void 0 : o.call({ userID: s[0], type: t, ...u }));
    } catch (l) {
      console.debug(l);
    }
  }
  async _handleGroupAttributesUpdated(e) {
    var l;
    if (fe.getData(n.CALL, a.CALL_STATUS) !== d.IDLE)
      return;
    const t = (e == null ? void 0 : e.data) || {}, { groupID: i = "", groupAttributes: o = {} } = t;
    i === ((l = this._callService) == null ? void 0 : l.getCurrentGroupId()) && await this.updateStoreBasedOnGroupAttributes(o);
  }
}
const h = Ee.getInstance(), vt = k.getInstance();
class W {
  constructor(e) {
    this._callService = e.callService;
  }
  static getInstance(e) {
    return W.instance || (W.instance = new W(e)), W.instance;
  }
  addListenTuiCallEngineEvent() {
    var t;
    const e = (t = this._callService) == null ? void 0 : t.getTUICallEngineInstance();
    if (!e) {
      console.warn(`${a.PREFIX}add engine event listener failed, engine is empty.`);
      return;
    }
    e.on(C.ERROR, this._handleError, this), e.on(C.INVITED, this._handleNewInvitationReceived, this), e.on(C.USER_ACCEPT, this._handleUserAccept, this), e.on(C.USER_ENTER, this._handleUserEnter, this), e.on(C.USER_LEAVE, this._handleUserLeave, this), e.on(C.REJECT, this._handleInviteeReject, this), e.on(C.NO_RESP, this._handleNoResponse, this), e.on(C.LINE_BUSY, this._handleLineBusy, this), e.on(C.CALLING_CANCEL, this._handleCallingCancel, this), e.on(C.SDK_READY, this._handleSDKReady, this), e.on(C.KICKED_OUT, this._handleKickedOut, this), e.on(C.MESSAGE_SENT_BY_ME, this._messageSentByMe, this), C.ON_USER_NETWORK_QUALITY_CHANGED && e.on(C.ON_USER_NETWORK_QUALITY_CHANGED, this._handleNetworkQuality, this), e.on(C.CALL_END, this._handleCallingEnd, this), e.on(C.CALL_MODE, this._handleCallTypeChange, this), e.on(C.USER_UPDATE, this._handleUserUpdate, this);
  }
  removeListenTuiCallEngineEvent() {
    var t;
    const e = (t = this._callService) == null ? void 0 : t.getTUICallEngineInstance();
    e.off(C.ERROR, this._handleError, this), e.off(C.INVITED, this._handleNewInvitationReceived, this), e.off(C.USER_ACCEPT, this._handleUserAccept, this), e.off(C.USER_ENTER, this._handleUserEnter, this), e.off(C.USER_LEAVE, this._handleUserLeave, this), e.off(C.REJECT, this._handleInviteeReject, this), e.off(C.NO_RESP, this._handleNoResponse, this), e.off(C.LINE_BUSY, this._handleLineBusy, this), e.off(C.CALLING_CANCEL, this._handleCallingCancel, this), e.off(C.SDK_READY, this._handleSDKReady, this), e.off(C.KICKED_OUT, this._handleKickedOut, this), e.off(C.MESSAGE_SENT_BY_ME, this._messageSentByMe, this), C.ON_USER_NETWORK_QUALITY_CHANGED && e.off(C.ON_USER_NETWORK_QUALITY_CHANGED, this._handleNetworkQuality, this), e.off(C.CALL_END, this._handleCallingEnd, this), e.off(C.CALL_MODE, this._handleCallTypeChange, this), e.off(C.USER_UPDATE, this._handleUserUpdate, this);
  }
  _callerChangeToConnected() {
    var i;
    const e = h.getData(n.CALL, a.CALL_ROLE);
    h.getData(n.CALL, a.CALL_STATUS) === d.CALLING && e === m.CALLER && (h.update(n.CALL, a.CALL_STATUS, d.CONNECTED), (i = this._callService) == null || i.startTimer());
  }
  _unNormalEventsManager(e, t) {
    var l;
    console.log(`${a.PREFIX}${t} event data: ${JSON.stringify(e)}.`);
    const i = h.getData(n.CALL, a.IS_GROUP), o = h.getData(n.CALL, a.REMOTE_USER_INFO_LIST);
    switch (t) {
      case C.REJECT:
      case C.LINE_BUSY: {
        const { userID: s } = v(e);
        let u = t === C.REJECT ? U.OTHER_SIDE_REJECT_CALL : U.OTHER_SIDE_LINE_BUSY, c = K(u);
        if (i) {
          const E = (o.find((I) => I.userId === s) || {}).displayUserInfo || s;
          u = t === C.REJECT ? U.REJECT_CALL : U.IN_BUSY, c = K(u, E);
        }
        h.update(n.CALL, a.TOAST_INFO, { text: c }), s && de([s]);
        break;
      }
      case C.NO_RESP: {
        const { userIDList: s = [] } = v(e), u = i ? U.TIMEOUT : U.CALL_TIMEOUT, c = s.map((I) => (o.find((_) => _.userId === I) || {}).displayUserInfo || I), E = i ? K(u, c.join()) : K(u);
        h.update(n.CALL, a.TOAST_INFO, { text: E }), s.length > 0 && de(s);
        break;
      }
      case C.CALLING_CANCEL: {
        (l = this._callService) == null || l._resetCallStore();
        break;
      }
    }
  }
  _handleError(e) {
    var s;
    const { code: t, message: i } = e || {}, o = Object.values(Ne).indexOf(t);
    let l = "";
    if (o !== -1) {
      const u = Object.keys(Ne)[o];
      l = y(tt[u]), l && h.update(n.CALL, a.TOAST_INFO, { text: l, type: a.ERROR });
    }
    (s = this._callService) == null || s.executeExternalAfterCalling(), console.error(`${a.PREFIX}_handleError, errorCode: ${t}; errorMessage: ${l || i}.`);
  }
  async _handleNewInvitationReceived(e) {
    var q, j, X, Z;
    console.log(`${a.PREFIX}onCallReceived event data: ${JSON.stringify(e)}.`);
    const { sponsor: t = "", isFromGroup: i, callMediaType: o, inviteData: l = {}, calleeIdList: s = [], groupID: u = "", roomID: c, strRoomID: E } = v(e), I = h.getData(n.CALL, a.LOCAL_USER_INFO), g = [t, ...s.filter((H) => H !== I.userId)], _ = o || l.callType, O = _ === L.AUDIO ? U.CALLEE_CALLING_AUDIO_MSG : U.CALLEE_CALLING_VIDEO_MSG;
    let N = {
      [a.CALL_ROLE]: m.CALLEE,
      [a.IS_GROUP]: i,
      [a.CALL_STATUS]: d.CALLING,
      [a.CALL_MEDIA_TYPE]: _,
      [a.CALL_TIPS]: y(O),
      [a.CALLER_USER_INFO]: { userId: t },
      [a.GROUP_ID]: u
    };
    be();
    const M = { enableCamera: _ === L.VIDEO, enableMic: !0 };
    N = { ...N, [a.PUSHER]: M };
    const z = {
      microphone: !0,
      camera: _ === L.VIDEO
    };
    this._callService._preDevicePermission = await this._callService._tuiCallEngine.deviceCheck(z), je(c, E), h.updateStore(N, n.CALL), (q = this._callService) == null || q.executeExternalBeforeCalling(), (j = this._callService) != null && j.statusChanged && ((X = this._callService) == null || X.statusChanged({ oldStatus: R.IDLE, newStatus: R.BE_INVITED }));
    const Q = await le(g, (Z = this._callService) == null ? void 0 : Z.getTim()), [w] = Q.filter((H) => H.userId === t);
    Q.length > 0 && h.updateStore({
      [a.REMOTE_USER_INFO_LIST]: Q,
      [a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST]: Q,
      [a.CALLER_USER_INFO]: {
        userId: t,
        nick: (w == null ? void 0 : w.nick) || "",
        avatar: (w == null ? void 0 : w.avatar) || "",
        displayUserInfo: (w == null ? void 0 : w.remark) || (w == null ? void 0 : w.nick) || t
      }
    }, n.CALL);
  }
  _handleUserAccept(e) {
    this._callerChangeToConnected(), h.update(n.CALL, a.TOAST_INFO, y("answered")), console.log(`${a.PREFIX}accept event data: ${JSON.stringify(e)}.`);
  }
  async _handleUserEnter(e) {
    var s;
    this._callerChangeToConnected();
    const { userID: t, data: i } = v(e);
    i != null && i.playerList && h.update(n.CALL, a.PLAYER, i.playerList);
    let o = h.getData(n.CALL, a.REMOTE_USER_INFO_LIST);
    if (!o.find((u) => (u == null ? void 0 : u.userId) === t)) {
      o.push({ userId: t }), o.length > 0 && (h.update(n.CALL, a.REMOTE_USER_INFO_LIST, o), h.update(n.CALL, a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, o));
      const [u] = await le([t], (s = this._callService) == null ? void 0 : s.getTim());
      o = h.getData(n.CALL, a.REMOTE_USER_INFO_LIST), o.forEach((c) => {
        (c == null ? void 0 : c.userId) === t && (c = Object.assign(c, u));
      });
    }
    o = o.map((u) => (u.userId === t && (u.isEnter = !0), u)), o.length > 0 && (h.update(n.CALL, a.REMOTE_USER_INFO_LIST, o), h.update(n.CALL, a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, o), vt.updateViewBackgroundUserId("remote")), console.log(`${a.PREFIX}userEnter event data: ${JSON.stringify(e)}.`);
  }
  _handleUserLeave(e) {
    console.log(`${a.PREFIX}userLeave event data: ${JSON.stringify(e)}.`);
    const { data: t, userID: i } = v(e);
    if (t != null && t.playerList && h.update(n.CALL, a.PLAYER, t.playerList), h.getData(n.CALL, a.IS_GROUP)) {
      const l = (h.getData(n.CALL, a.REMOTE_USER_INFO_LIST).find((u) => u.userId === i) || {}).displayUserInfo || i, s = K(U.END_CALL, l);
      h.update(n.CALL, a.TOAST_INFO, { text: s });
    }
    i && de([i]);
  }
  _handleInviteeReject(e) {
    this._unNormalEventsManager(e, C.REJECT);
  }
  _handleNoResponse(e) {
    this._unNormalEventsManager(e, C.NO_RESP);
  }
  _handleLineBusy(e) {
    this._unNormalEventsManager(e, C.LINE_BUSY);
  }
  _handleCallingCancel(e) {
    var t;
    (t = this._callService) == null || t.executeExternalAfterCalling(), this._unNormalEventsManager(e, C.CALLING_CANCEL);
  }
  _handleCallingEnd(e) {
    var t, i;
    console.log(`${a.PREFIX}callEnd event data: ${JSON.stringify(e)}.`), (t = this._callService) == null || t.executeExternalAfterCalling(), (i = this._callService) == null || i._resetCallStore();
  }
  // SDK_READY 后才能调用 tim 接口, 否则登录后立刻获取导致调用接口失败. v2.27.4+、v3 接口 login 后会抛出 SDK_READY
  async _handleSDKReady(e) {
    var i, o, l;
    let t = h.getData(n.CALL, a.LOCAL_USER_INFO);
    t = await Ft(t.userId, (i = this._callService) == null ? void 0 : i.getTim()), (l = this._callService) == null || l.setDefaultOfflinePushInfo({ ...(o = this._callService) == null ? void 0 : o.getDefaultOfflinePushInfo(), title: t == null ? void 0 : t.displayUserInfo }), h.update(n.CALL, a.LOCAL_USER_INFO, t), h.update(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN, t);
  }
  _handleKickedOut(e) {
    var t, i, o;
    console.log(`${a.PREFIX}kickOut event data: ${JSON.stringify(e)}.`), (t = this._callService) != null && t.kickedOut && ((i = this._callService) == null || i.kickedOut(e)), h.update(n.CALL, a.CALL_TIPS, K(U.KICK_OUT)), (o = this._callService) == null || o._resetCallStore();
  }
  _messageSentByMe(e) {
    var i, o;
    const t = e == null ? void 0 : e.data;
    (i = this._callService) != null && i.onMessageSentByMe && ((o = this._callService) == null || o.onMessageSentByMe(t));
  }
  _handleCallTypeChange(e) {
    var o;
    const { newCallType: t, type: i } = v(e);
    h.update(n.CALL, a.CALL_MEDIA_TYPE, t || i), (o = this._callService) == null || o.setSoundMode(T.EAR);
  }
  _handleNetworkQuality(e) {
    const { networkQualityList: t = [] } = v(e);
    h.update(n.CALL, a.NETWORK_STATUS, t);
    const i = h.getData(n.CALL, a.IS_GROUP), o = h.getData(n.CALL, a.LOCAL_USER_INFO), l = h.getData(n.CALL, a.REMOTE_USER_INFO_LIST);
    if (!i) {
      if (t.find((c) => {
        var E;
        return ((E = l[0]) == null ? void 0 : E.userId) === (c == null ? void 0 : c.userId) && (c == null ? void 0 : c.quality) >= me;
      })) {
        h.update(n.CALL, a.CALL_TIPS, y(U.REMOTE_NETWORK_IS_POOR));
        return;
      }
      if (t.find((c) => (o == null ? void 0 : o.userId) === (c == null ? void 0 : c.userId) && (c == null ? void 0 : c.quality) >= me)) {
        h.update(n.CALL, a.CALL_TIPS, y(U.LOCAL_NETWORK_IS_POOR));
        return;
      }
    }
  }
  // ==========================【 miniProgram 私有事件】==========================
  _handleUserUpdate(e) {
    const t = v(e);
    t != null && t.pusher && h.update(n.CALL, a.PUSHER, t.pusher), t != null && t.playerList && h.update(n.CALL, a.PLAYER, t.playerList);
  }
}
var Pt = Object.defineProperty, Kt = Object.getOwnPropertyDescriptor, D = (r, e, t, i) => {
  for (var o = i > 1 ? void 0 : i ? Kt(e, t) : e, l = r.length - 1, s; l >= 0; l--)
    (s = r[l]) && (o = (i ? s(e, t, o) : s(o)) || o);
  return i && o && Pt(e, t, o), o;
};
const Ht = We.getInstance(), A = Ee.getInstance(), P = k.getInstance();
P.setTUIStore(A);
const ve = "3.3.4", f = class ie {
  constructor() {
    this._tim = null, this._TUICore = null, this._timerId = -1, this._startTimeStamp = he(), this._bellContext = null, this._isFromChat = !1, this._currentGroupId = "", this._preDevicePermission = !1, this._defaultOfflinePushInfo = {
      title: "",
      description: y("you have a new call")
    }, this._permissionCheckTimer = null, this._chatCombine = null, this._engineEventHandler = null, this._handleCallStatusChange = async (e) => {
      var t, i, o, l;
      try {
        const s = {
          callRole: A.getData(n.CALL, a.CALL_ROLE),
          callStatus: A.getData(n.CALL, a.CALL_STATUS)
        };
        if (this._bellContext.setBellProperties(s), e === d.CALLING)
          await ((t = this == null ? void 0 : this._bellContext) == null ? void 0 : t.play());
        else {
          if (e === d.CONNECTED) {
            const u = A.getData(n.CALL, a.IS_GROUP), c = A.getData(n.CALL, a.CALL_MEDIA_TYPE), E = A.getData(n.CALL, a.REMOTE_USER_INFO_LIST), I = u ? R.DIALING_GROUP : R.DIALING_C2C;
            A.update(n.CALL, a.CALL_TIPS, ""), this.statusChanged && this.statusChanged({ oldStatus: I, newStatus: se() }), !u && c === L.VIDEO && this.switchScreen(E[0].domId);
          }
          if (e === d.IDLE && this._isFromChat) {
            const u = this._currentGroupId ? await ((i = this._chatCombine) == null ? void 0 : i.getGroupAttributes(this._tim, this._currentGroupId)) : {};
            await ((o = this._chatCombine) == null ? void 0 : o.updateStoreBasedOnGroupAttributes(u, A, this));
          }
          await ((l = this == null ? void 0 : this._bellContext) == null ? void 0 : l.stop());
        }
      } catch (s) {
        console.warn(`${a.PREFIX}handleCallStatusChange, ${s}.`);
      }
    }, console.log(`${a.PREFIX}version: ${ve}`), this._watchTUIStore(), this._engineEventHandler = W.getInstance({ callService: this }), this._chatCombine = x.getInstance({ callService: this });
  }
  static getInstance() {
    return ie.instance || (ie.instance = new ie()), ie.instance;
  }
  async init(e) {
    var t, i;
    try {
      if (this._tuiCallEngine)
        return;
      let { userID: o, tim: l, userSig: s, sdkAppID: u, SDKAppID: c, isFromChat: E, component: I = Se.TUI_CALL_KIT } = e;
      this._TUICore && (u = this._TUICore.SDKAppID, l = this._TUICore.tim), this._tim = l, console.log(`${a.PREFIX}init sdkAppId: ${u || c}, userId: ${o}`), this._tuiCallEngine = Ze.createInstance({
        tim: l,
        // @ts-ignore
        sdkAppID: u || c,
        // 兼容传入 SDKAppID 的问题
        callkitVersion: ve,
        chat: E || !1,
        component: I
      }), P.setEngineInstance(this._tuiCallEngine), this._addListenTuiCallEngineEvent(), this._bellContext = new Nt(), A.update(n.CALL, a.LOCAL_USER_INFO, { userId: o }), A.update(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { userId: o }), P.updateViewBackgroundUserId("local"), await this._tuiCallEngine.login({ userID: o, userSig: s, assetsPath: "" });
      const g = A.getData(n.CALL, a.CUSTOM_UI_CONFIG);
      (i = (t = this._tuiCallEngine) == null ? void 0 : t.reportLog) == null || i.call(t, {
        name: "TUICallkit.init",
        data: {
          uiConfig: g
        }
      });
    } catch (o) {
      throw console.error(`${a.PREFIX}init failed, error: ${o}.`), o;
    }
  }
  // component destroy
  async destroyed() {
    var e;
    try {
      const t = A.getData(n.CALL, a.CALL_STATUS);
      if (t !== d.IDLE)
        throw new Error(`please destroyed when status is idle, current status: ${t}`);
      this._tuiCallEngine && (this._removeListenTuiCallEngineEvent(), await this._tuiCallEngine.destroyInstance(), this._tuiCallEngine = null), (e = this._bellContext) == null || e.destroy(), this._bellContext = null;
    } catch (t) {
      throw console.error(`${a.PREFIX}destroyed failed, error: ${t}.`), t;
    }
  }
  async call(e) {
    if (A.getData(n.CALL, a.CALL_STATUS) === d.IDLE)
      try {
        const { type: t, userID: i, offlinePushInfo: o } = e;
        if (A.getData(n.CALL, a.CALL_STATUS) !== d.IDLE)
          return;
        await this._updateCallStoreBeforeCall(t, [{ userId: i }]), this.executeExternalBeforeCalling(), e.offlinePushInfo = { ...this._defaultOfflinePushInfo, ...o };
        const l = await this._tuiCallEngine.call(e);
        await this._updateCallStoreAfterCall([i], l);
      } catch (t) {
        this._handleCallError(t, "call");
      }
  }
  async groupCall(e) {
    if (A.getData(n.CALL, a.CALL_STATUS) === d.IDLE)
      try {
        const { userIDList: t, type: i, groupID: o, offlinePushInfo: l } = e;
        if (A.getData(n.CALL, a.CALL_STATUS) !== d.IDLE)
          return;
        const s = t.map((c) => ({ userId: c }));
        await this._updateCallStoreBeforeCall(i, s, o), this.executeExternalBeforeCalling(), e.offlinePushInfo = { ...this._defaultOfflinePushInfo, ...l };
        const u = await this._tuiCallEngine.groupCall(e);
        await this._updateCallStoreAfterCall(t, u);
      } catch (t) {
        this._handleCallError(t, "groupCall");
      }
  }
  async inviteUser(e) {
    if (A.getData(n.CALL, a.CALL_STATUS) !== d.IDLE)
      try {
        const { userIDList: t } = e;
        let i = await le(t, this.getTim());
        const o = A.getData(n.CALL, a.REMOTE_USER_INFO_LIST);
        A.update(n.CALL, a.REMOTE_USER_INFO_LIST, [...o, ...i]), A.update(n.CALL, a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, [...o, ...i]), this._tuiCallEngine && await this._tuiCallEngine.inviteUser(e);
      } catch (t) {
        throw console.error(`${a.PREFIX}inviteUser failed, error: ${t}.`), this._resetCallStore(), t;
      }
  }
  async joinInGroupCall(e) {
    if (A.getData(n.CALL, a.CALL_STATUS) !== d.CONNECTED)
      try {
        const t = {
          [a.CALL_ROLE]: m.CALLEE,
          [a.IS_GROUP]: !0,
          [a.CALL_STATUS]: d.CONNECTED,
          [a.CALL_MEDIA_TYPE]: e.type,
          [a.GROUP_ID]: e.groupID,
          [a.ROOM_ID]: e.roomID
        };
        A.updateStore(t, n.CALL);
        const i = await this._tuiCallEngine.joinInGroupCall(e), o = this._getFeatureButtonDefaultState(Y.Camera) === J.Close;
        e.type === L.VIDEO && !o && await this.openCamera(a.LOCAL_VIDEO), A.update(n.CALL, a.IS_CLICKABLE, !0), this.startTimer(), A.update(n.CALL, a.PUSHER, i), this.setSoundMode(e.type === L.AUDIO ? T.EAR : T.SPEAKER);
        const l = A.getData(n.CALL, a.LOCAL_USER_INFO);
        A.update(n.CALL, a.LOCAL_USER_INFO, { ...l, isEnter: !0 }), A.update(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { ...l, isEnter: !0 }), b(!0, a.AUDIO);
      } catch (t) {
        this._handleCallError(t, "joinInGroupCall");
      }
  }
  // ===============================【其它对外接口】===============================
  getTUICallEngineInstance() {
    return (this == null ? void 0 : this._tuiCallEngine) || null;
  }
  setLogLevel(e) {
    var t;
    (t = this == null ? void 0 : this._tuiCallEngine) == null || t.setLogLevel(e);
  }
  setLanguage(e) {
    e && Object.values(Pe).includes(e) && A.update(n.CALL, a.LANGUAGE, e);
  }
  enableFloatWindow(e) {
    A.update(n.CALL, a.ENABLE_FLOAT_WINDOW, e);
  }
  async setSelfInfo(e) {
    const { nickName: t, avatar: i } = e;
    try {
      await this._tuiCallEngine.setSelfInfo(t, i);
    } catch (o) {
      console.error(`${a.PREFIX}setSelfInfo failed, error: ${o}.`);
    }
  }
  async enableVirtualBackground(e) {
    A.update(n.CALL, a.IS_SHOW_ENABLE_VIRTUAL_BACKGROUND, e);
  }
  async setCallingBell(e) {
    const t = { calleeBellFilePath: e };
    this._bellContext.setBellProperties(t);
  }
  async enableMuteMode(e) {
    try {
      const t = { isMuteBell: e };
      this._bellContext.setBellProperties(t), await this._bellContext.setBellMute(e);
    } catch (t) {
      console.warn(`${a.PREFIX}enableMuteMode failed, error: ${t}.`);
    }
  }
  hideFeatureButton(e) {
    P.hideFeatureButton(e);
  }
  setLocalViewBackgroundImage(e) {
    P.setLocalViewBackgroundImage(e);
  }
  setRemoteViewBackgroundImage(e, t) {
    P.setRemoteViewBackgroundImage(e, t);
  }
  setLayoutMode(e) {
    P.setLayoutMode(e);
  }
  setCameraDefaultState(e) {
    P.setCameraDefaultState(e);
  }
  async accept() {
    var t, i, o, l, s, u;
    const e = A.getData(n.CALL, a.CALL_STATUS);
    if ((i = (t = this._tuiCallEngine) == null ? void 0 : t.reportLog) == null || i.call(t, {
      name: "TUICallKit.accept.start",
      data: { callStatus: e }
    }), e !== d.CONNECTED)
      try {
        const E = {
          microphone: !0,
          camera: A.getData(n.CALL, a.CALL_MEDIA_TYPE) === L.VIDEO
        }, I = await this._tuiCallEngine.deviceCheck(E);
        I && !this._preDevicePermission && (A.update(n.CALL, a.PUSHER_ID, a.NEW_PUSHER), this._preDevicePermission = I);
        const g = await this._tuiCallEngine.accept();
        if (g) {
          A.update(n.CALL, a.CALL_STATUS, d.CONNECTED), (l = this._chatCombine) == null || l.callTUIService({ message: (o = g == null ? void 0 : g.data) == null ? void 0 : o.message }), A.update(n.CALL, a.IS_CLICKABLE, !0), this.startTimer();
          const _ = A.getData(n.CALL, a.CALL_MEDIA_TYPE), O = this._getFeatureButtonDefaultState(Y.Camera) === J.Close;
          _ === L.VIDEO && !O && await this.openCamera(a.LOCAL_VIDEO), g.pusher && A.update(n.CALL, a.PUSHER, g.pusher), this.setSoundMode(_ === L.AUDIO ? T.EAR : T.SPEAKER);
          const N = A.getData(n.CALL, a.LOCAL_USER_INFO);
          A.update(n.CALL, a.LOCAL_USER_INFO, { ...N, isEnter: !0 }), A.update(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { ...N, isEnter: !0 }), b(!0, a.AUDIO);
        }
      } catch (c) {
        if ((u = (s = this._tuiCallEngine) == null ? void 0 : s.reportLog) == null || u.call(s, {
          name: "TUICallKit.accept.fail",
          level: "error",
          error: c
        }), Me(c))
          return;
        Le(c, L.AUDIO, this._tuiCallEngine), this._resetCallStore();
      }
  }
  async hangup() {
    if (A.getData(n.CALL, a.CALL_STATUS) !== d.IDLE) {
      try {
        const e = await this._tuiCallEngine.hangup();
        e == null || e.forEach((t) => {
          var i, o;
          (t == null ? void 0 : t.code) === 0 && ((o = this._chatCombine) == null || o.callTUIService({ message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message }));
        });
      } catch (e) {
        console.debug(e);
      }
      this._resetCallStore();
    }
  }
  async reject() {
    var e, t;
    if (A.getData(n.CALL, a.CALL_STATUS) !== d.IDLE) {
      try {
        const i = await this._tuiCallEngine.reject();
        (i == null ? void 0 : i.code) === 0 && ((t = this._chatCombine) == null || t.callTUIService({ message: (e = i == null ? void 0 : i.data) == null ? void 0 : e.message }));
      } catch (i) {
        console.debug(i);
      }
      this._resetCallStore();
    }
  }
  async openCamera(e) {
    try {
      await this._tuiCallEngine.openCamera(), b(!0, a.VIDEO);
    } catch (t) {
      Le(t, L.VIDEO, this._tuiCallEngine), console.error(`${a.PREFIX}openCamera error: ${t}.`);
    }
  }
  async closeCamera() {
    try {
      await this._tuiCallEngine.closeCamera(), b(!1, a.VIDEO);
    } catch (e) {
      console.error(`${a.PREFIX}closeCamera error: ${e}.`);
    }
  }
  async openMicrophone() {
    try {
      await this._tuiCallEngine.openMicrophone(), b(!0, a.AUDIO);
    } catch (e) {
      console.error(`${a.PREFIX}openMicrophone failed, error: ${e}.`);
    }
  }
  async closeMicrophone() {
    try {
      await this._tuiCallEngine.closeMicrophone(), b(!1, a.AUDIO);
    } catch (e) {
      console.error(`${a.PREFIX}closeMicrophone failed, error: ${e}.`);
    }
  }
  switchScreen(e) {
    e && A.update(n.CALL, a.BIG_SCREEN_USER_ID, e);
  }
  async switchCallMediaType() {
    var e, t;
    try {
      const i = A.getData(n.CALL, a.CALL_MEDIA_TYPE);
      if (i === L.AUDIO) {
        console.warn(`${a.PREFIX}switchCallMediaType failed, ${i} not support.`);
        return;
      }
      const o = await this._tuiCallEngine.switchCallMediaType(L.AUDIO);
      (o == null ? void 0 : o.code) === 0 && ((t = this._chatCombine) == null || t.callTUIService({ message: (e = o == null ? void 0 : o.data) == null ? void 0 : e.message })), A.update(n.CALL, a.CALL_MEDIA_TYPE, L.AUDIO);
      const s = A.getData(n.CALL, a.IS_GROUP) ? R.CALLING_GROUP_VIDEO : R.CALLING_C2C_VIDEO, u = se();
      this.statusChanged && this.statusChanged({ oldStatus: s, newStatus: u }), this.setSoundMode(T.EAR);
    } catch (i) {
      console.error(`${a.PREFIX}switchCallMediaType failed, error: ${i}.`);
    }
  }
  async switchCamera() {
    const t = A.getData(n.CALL, a.CAMERA_POSITION) === ne.BACK ? ne.FRONT : ne.BACK;
    try {
      await this._tuiCallEngine.switchCamera(t), A.update(n.CALL, a.CAMERA_POSITION, t);
    } catch (i) {
      console.error(`${a.PREFIX}_switchCamera failed, error: ${i}.`);
    }
  }
  setSoundMode(e) {
    var t;
    try {
      let i = A.getData(n.CALL, a.IS_EAR_PHONE);
      const o = e || (i ? T.SPEAKER : T.EAR);
      (t = this._tuiCallEngine) == null || t.selectAudioPlaybackDevice(o), e ? i = e === T.EAR : i = !i, A.update(n.CALL, a.IS_EAR_PHONE, i);
    } catch (i) {
      console.error(`${a.PREFIX}setSoundMode failed, error: ${i}.`);
    }
  }
  async setBlurBackground(e) {
    try {
      A.update(n.CALL, a.ENABLE_VIRTUAL_BACKGROUND, e);
    } catch (t) {
      console.error(`${a.PREFIX}_setBlurBackground failed, error: ${t}.`);
    }
  }
  // ==========================【TUICallEngine 事件处理】==========================
  _addListenTuiCallEngineEvent() {
    this._engineEventHandler.addListenTuiCallEngineEvent();
  }
  _removeListenTuiCallEngineEvent() {
    this._engineEventHandler.removeListenTuiCallEngineEvent();
  }
  setCallback(e) {
    const { beforeCalling: t, afterCalling: i, onMinimized: o, onMessageSentByMe: l, kickedOut: s, statusChanged: u } = e;
    t && (this.beforeCalling = t), i && (this.afterCalling = i), o && (this.onMinimized = o), l && (this.onMessageSentByMe = l), s && (this.kickedOut = s), u && (this.statusChanged = u);
  }
  toggleMinimize() {
    const e = A.getData(n.CALL, a.IS_MINIMIZED);
    A.update(n.CALL, a.IS_MINIMIZED, !e), console.log(`${a.PREFIX}toggleMinimize: ${e} -> ${!e}.`), this.onMinimized && this.onMinimized(e, !e);
  }
  executeExternalBeforeCalling() {
    this.beforeCalling && this.beforeCalling();
  }
  executeExternalAfterCalling() {
    this.afterCalling && this.afterCalling();
  }
  // =========================【 miniProgram 公共方法】=========================
  // 处理用户异常退出的情况，处理了右滑退出，以及返回退出的情况。
  async handleExceptionExit() {
    try {
      if (A.getData(n.CALL, a.CALL_STATUS) === d.IDLE)
        return;
      this._resetCallStore(), await this._tuiCallEngine.handleExceptionExit();
    } catch (e) {
      console.error(`${a.PREFIX} handleExceptionExit failed, error: ${e}.`);
    }
  }
  // 处理 pusher 内部错误，没有 live-pusher 能力时做出弹窗提示。
  handlePusherError(e) {
    var t;
    ((t = e == null ? void 0 : e.detail) == null ? void 0 : t.errMsg) === "fail:access denied" && ct();
  }
  setVideoDisplayMode(e) {
    A.update(n.CALL, a.DISPLAY_MODE, e);
  }
  async setVideoResolution(e) {
    var t;
    try {
      if (!e)
        return;
      A.update(n.CALL, a.VIDEO_RESOLUTION, e), await ((t = this._tuiCallEngine) == null ? void 0 : t.setVideoQuality(e));
    } catch (i) {
      console.warn(`${a.PREFIX}setVideoResolution failed, error: ${i}.`);
    }
  }
  // 通话时长更新
  startTimer() {
    this._timerId === -1 && (this._startTimeStamp = he(), this._timerId = Ie.run(a.TIMEOUT, this._updateCallDuration.bind(this), { delay: 1e3 }));
  }
  // =========================【private methods for service use】=========================
  // 处理 “呼叫” 抛出的异常
  _handleCallError(e, t) {
    if (this._permissionCheckTimer && clearInterval(this._permissionCheckTimer), !Me(e))
      throw At(e), Le(e, L.AUDIO, this._tuiCallEngine), console.error(`${a.PREFIX}${t} failed, error: ${e}.`), this._resetCallStore(), e;
  }
  async _updateCallStoreBeforeCall(e, t, i) {
    const o = i || A.getData(n.CALL, a.IS_MINIMIZED) ? U.CALLER_GROUP_CALLING_MSG : U.CALLER_CALLING_MSG;
    let l = {
      [a.CALL_MEDIA_TYPE]: e,
      [a.CALL_ROLE]: m.CALLER,
      [a.REMOTE_USER_INFO_LIST]: t,
      [a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST]: t,
      [a.IS_GROUP]: !!i,
      [a.CALL_TIPS]: y(o),
      [a.GROUP_ID]: i
    };
    const s = { enableCamera: e === L.VIDEO, enableMic: !0 };
    l = { ...l, [a.PUSHER]: s }, A.updateStore(l, n.CALL);
    const u = await st(e, this);
    console.log(`${a.PREFIX}mini beforeCall return callStatus: ${u}.`), A.update(n.CALL, a.CALL_STATUS, u);
    const c = await le(t.map((g) => g.userId), this.getTim());
    c.length > 0 && (A.update(n.CALL, a.REMOTE_USER_INFO_LIST, c), A.update(n.CALL, a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, c));
    const E = {
      microphone: !0,
      camera: e === L.VIDEO
    };
    let I = await this._tuiCallEngine.deviceCheck(E);
    I || (this._permissionCheckTimer && clearInterval(this._permissionCheckTimer), this._permissionCheckTimer = setInterval(async () => {
      I = await this._tuiCallEngine.deviceCheck(E), I && this._permissionCheckTimer && (clearInterval(this._permissionCheckTimer), A.update(n.CALL, a.CALL_STATUS, d.CALLING));
    }, 500));
  }
  async _updateCallStoreAfterCall(e, t) {
    var i, o;
    if (t) {
      A.update(n.CALL, a.IS_CLICKABLE, !0), je(t == null ? void 0 : t.roomID, t == null ? void 0 : t.strRoomID);
      const l = A.getData(n.CALL, a.CALL_MEDIA_TYPE);
      (o = this._chatCombine) == null || o.callTUIService({ message: (i = t == null ? void 0 : t.data) == null ? void 0 : i.message }), t.pusher && A.update(n.CALL, a.PUSHER, t.pusher), this.setSoundMode(l === L.AUDIO ? T.EAR : T.SPEAKER), A.update(n.CALL, a.CALL_STATUS, d.CALLING);
      const s = this._getFeatureButtonDefaultState(Y.Camera) === J.Close;
      l === L.VIDEO && !s && await this.openCamera(a.LOCAL_VIDEO);
      const u = A.getData(n.CALL, a.LOCAL_USER_INFO);
      A.update(n.CALL, a.LOCAL_USER_INFO, { ...u, isEnter: !0 }), A.update(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN, { ...u, isEnter: !0 }), b(!0, a.AUDIO);
    } else
      this._permissionCheckTimer && clearInterval(this._permissionCheckTimer), this._permissionCheckTimer = null, this._resetCallStore();
  }
  _getFeatureButtonDefaultState(e) {
    var i;
    const { button: t } = A.getData(n.CALL, a.CUSTOM_UI_CONFIG);
    return (i = t == null ? void 0 : t[e]) == null ? void 0 : i.state;
  }
  _updateCallDuration() {
    const e = Math.round((he() - this._startTimeStamp) / 1e3), t = pt(e);
    A.update(n.CALL, a.CALL_DURATION, t);
  }
  _stopTimer() {
    this._timerId !== -1 && (Ie.clearTask(this._timerId), this._timerId = -1);
  }
  _resetCallStore() {
    const e = se();
    this._stopTimer();
    let t = Object.keys(Ae).filter((l) => {
      switch (Ae[l]) {
        case a.CALL_STATUS:
        case a.LANGUAGE:
        case a.IS_GROUP:
        case a.DISPLAY_MODE:
        case a.VIDEO_RESOLUTION:
        case a.ENABLE_FLOAT_WINDOW:
        case a.LOCAL_USER_INFO:
        case a.IS_SHOW_ENABLE_VIRTUAL_BACKGROUND:
        case a.LOCAL_USER_INFO_EXCLUDE_VOLUMN:
          return !1;
        default:
          return !0;
      }
    });
    t = t.map((l) => Ae[l]), A.reset(n.CALL, t), A.getData(n.CALL, a.CALL_STATUS) !== d.IDLE && A.reset(n.CALL, [a.CALL_STATUS], !0), A.reset(n.CALL, [a.IS_MINIMIZED], !0), A.reset(n.CALL, [a.IS_EAR_PHONE], !0), A.reset(n.CALL, [a.ENABLE_VIRTUAL_BACKGROUND], !0), A.update(n.CALL, a.LOCAL_USER_INFO, {
      ...A.getData(n.CALL, a.LOCAL_USER_INFO),
      isVideoAvailable: !1,
      isAudioAvailable: !1
    }), A.update(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN, {
      ...A.getData(n.CALL, a.LOCAL_USER_INFO_EXCLUDE_VOLUMN),
      isVideoAvailable: !1,
      isAudioAvailable: !1
    }), A.update(n.CALL, a.REMOTE_USER_INFO_LIST, []), A.update(n.CALL, a.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, []);
    const o = se();
    e !== o && this.statusChanged && this.statusChanged({ oldStatus: e, newStatus: o });
  }
  // =========================【Calling the Chat SDK APi】=========================
  // 获取群成员
  async getGroupMemberList(e, t) {
    const i = A.getData(n.CALL, a.GROUP_ID);
    return await Mt(i, this.getTim(), e, t);
  }
  // 获取群信息
  async getGroupProfile() {
    const e = A.getData(n.CALL, a.GROUP_ID);
    return await yt(e, this.getTim());
  }
  _watchTUIStore() {
    A == null || A.watch(n.CALL, {
      [a.CALL_STATUS]: this._handleCallStatusChange
    });
  }
  _unwatchTUIStore() {
    A == null || A.unwatch(n.CALL, {
      [a.CALL_STATUS]: this._handleCallStatusChange
    });
  }
  // =========================【融合 chat 】=========================
  bindTUICore(e) {
    this._TUICore = e;
  }
  // =========================【set、get methods】=========================
  getTim() {
    var e, t;
    return this._tim ? this._tim : this._tuiCallEngine ? ((e = this._tuiCallEngine) == null ? void 0 : e.tim) || ((t = this._tuiCallEngine) == null ? void 0 : t.getTim()) : (console.warn(`${a.PREFIX}getTim warning: _tuiCallEngine Instance is not available.`), null);
  }
  setIsFromChat(e) {
    this._isFromChat = e;
  }
  setCurrentGroupId(e) {
    this._currentGroupId = e;
  }
  getCurrentGroupId() {
    return this._currentGroupId;
  }
  setDefaultOfflinePushInfo(e) {
    this._defaultOfflinePushInfo = e;
  }
  getDefaultOfflinePushInfo() {
    return this._defaultOfflinePushInfo;
  }
};
D([
  B(),
  G(F.init)
], f.prototype, "init", 1);
D([
  B(),
  G(F.call),
  Ce({ engineInstance: !0 })
], f.prototype, "call", 1);
D([
  B(),
  G(F.groupCall),
  Ce({ engineInstance: !0 })
], f.prototype, "groupCall", 1);
D([
  B(),
  G(F.inviteUser),
  Ce({ engineInstance: !0 })
], f.prototype, "inviteUser", 1);
D([
  B(),
  G(F.joinInGroupCall),
  Ce({ engineInstance: !0 })
], f.prototype, "joinInGroupCall", 1);
D([
  G(F.setLanguage)
], f.prototype, "setLanguage", 1);
D([
  G(F.enableFloatWindow)
], f.prototype, "enableFloatWindow", 1);
D([
  G(F.setSelfInfo)
], f.prototype, "setSelfInfo", 1);
D([
  G(F.setCallingBell)
], f.prototype, "setCallingBell", 1);
D([
  G(F.enableMuteMode)
], f.prototype, "enableMuteMode", 1);
D([
  B()
], f.prototype, "accept", 1);
D([
  B()
], f.prototype, "hangup", 1);
D([
  B()
], f.prototype, "reject", 1);
D([
  B()
], f.prototype, "openCamera", 1);
D([
  B()
], f.prototype, "closeCamera", 1);
D([
  B()
], f.prototype, "openMicrophone", 1);
D([
  B()
], f.prototype, "closeMicrophone", 1);
D([
  B()
], f.prototype, "switchScreen", 1);
D([
  B()
], f.prototype, "switchCallMediaType", 1);
D([
  B()
], f.prototype, "switchCamera", 1);
D([
  B()
], f.prototype, "setSoundMode", 1);
D([
  B()
], f.prototype, "setBlurBackground", 1);
D([
  G(F.setVideoDisplayMode)
], f.prototype, "setVideoDisplayMode", 1);
D([
  G(F.setVideoResolution)
], f.prototype, "setVideoResolution", 1);
let Vt = f;
const xt = Vt.getInstance(), Wt = "3.3.4";
export {
  L as CallMediaType,
  m as CallRole,
  Y as FeatureButton,
  Ke as LayoutMode,
  a as NAME,
  R as STATUS,
  n as StoreName,
  xt as TUICallKitServer,
  Ht as TUIGlobal,
  A as TUIStore,
  Wt as Version,
  re as VideoDisplayMode,
  oe as VideoResolution,
  y as t,
  P as uiDesign
};
